// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gax;
extern crate gaxi;
extern crate iam_v1;
extern crate lazy_static;
extern crate location;
extern crate longrunning;
extern crate lro;
extern crate reqwest;
extern crate rpc;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;

mod debug;
mod deserialize;
mod serialize;

/// A Deployment is a group of resources and configs managed and provisioned by
/// Infra Manager.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Deployment {
    /// Identifier. Resource name of the deployment.
    /// Format: `projects/{project}/locations/{location}/deployments/{deployment}`
    pub name: std::string::String,

    /// Output only. Time when the deployment was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Time when the deployment was last modified.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. User-defined metadata for the deployment.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Output only. Current state of the deployment.
    pub state: crate::model::deployment::State,

    /// Output only. Revision name that was most recently applied.
    /// Format: `projects/{project}/locations/{location}/deployments/{deployment}/
    /// revisions/{revision}`
    pub latest_revision: std::string::String,

    /// Output only. Additional information regarding the current state.
    pub state_detail: std::string::String,

    /// Output only. Error code describing errors that may have occurred.
    pub error_code: crate::model::deployment::ErrorCode,

    /// Output only. Location of artifacts from a DeleteDeployment operation.
    pub delete_results: std::option::Option<crate::model::ApplyResults>,

    /// Output only. Cloud Build instance UUID associated with deleting this
    /// deployment.
    pub delete_build: std::string::String,

    /// Output only. Location of Cloud Build logs in Google Cloud Storage,
    /// populated when deleting this deployment. Format: `gs://{bucket}/{object}`.
    pub delete_logs: std::string::String,

    /// Output only. Errors encountered when deleting this deployment.
    /// Errors are truncated to 10 entries, see `delete_results` and `error_logs`
    /// for full details.
    pub tf_errors: std::vec::Vec<crate::model::TerraformError>,

    /// Output only. Location of Terraform error logs in Google Cloud Storage.
    /// Format: `gs://{bucket}/{object}`.
    pub error_logs: std::string::String,

    /// Optional. User-defined location of Cloud Build logs and artifacts in Google
    /// Cloud Storage. Format: `gs://{bucket}/{folder}`
    ///
    /// A default bucket will be bootstrapped if the field is not set or empty.
    /// Default bucket format: `gs://<project number>-<region>-blueprint-config`
    /// Constraints:
    ///
    /// - The bucket needs to be in the same project as the deployment
    /// - The path cannot be within the path of `gcs_source`
    /// - The field cannot be updated, including changing its presence
    pub artifacts_gcs_bucket: std::option::Option<std::string::String>,

    /// Required. User-specified Service Account (SA) credentials to be used when
    /// actuating resources.
    /// Format: `projects/{projectID}/serviceAccounts/{serviceAccount}`
    pub service_account: std::option::Option<std::string::String>,

    /// By default, Infra Manager will return a failure when
    /// Terraform encounters a 409 code (resource conflict error) during actuation.
    /// If this flag is set to true, Infra Manager will instead
    /// attempt to automatically import the resource into the Terraform state (for
    /// supported resource types) and continue actuation.
    ///
    /// Not all resource types are supported, refer to documentation.
    pub import_existing_resources: std::option::Option<bool>,

    /// Optional. The user-specified Cloud Build worker pool resource in which the
    /// Cloud Build job will execute. Format:
    /// `projects/{project}/locations/{location}/workerPools/{workerPoolId}`.
    /// If this field is unspecified, the default Cloud Build worker pool will be
    /// used.
    pub worker_pool: std::option::Option<std::string::String>,

    /// Output only. Current lock state of the deployment.
    pub lock_state: crate::model::deployment::LockState,

    /// Optional. The user-specified Terraform version constraint.
    /// Example: "=1.3.10".
    pub tf_version_constraint: std::option::Option<std::string::String>,

    /// Output only. The current Terraform version set on the deployment.
    /// It is in the format of "Major.Minor.Patch", for example, "1.3.10".
    pub tf_version: std::string::String,

    /// Optional. Input to control quota checks for resources in terraform
    /// configuration files. There are limited resources on which quota validation
    /// applies.
    pub quota_validation: crate::model::QuotaValidation,

    /// Optional. Arbitrary key-value metadata storage e.g. to help client tools
    /// identify deployments during automation. See
    /// <https://google.aip.dev/148#annotations> for details on format and size
    /// limitations.
    pub annotations: std::collections::HashMap<std::string::String, std::string::String>,

    /// Optional. This field specifies the provider configurations.
    pub provider_config: std::option::Option<crate::model::ProviderConfig>,

    /// Blueprint to deploy.
    pub blueprint: std::option::Option<crate::model::deployment::Blueprint>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Deployment {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Deployment::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::Deployment::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::Deployment::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::Deployment::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::Deployment::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [labels][crate::model::Deployment::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [state][crate::model::Deployment::state].
    pub fn set_state<T: std::convert::Into<crate::model::deployment::State>>(
        mut self,
        v: T,
    ) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [latest_revision][crate::model::Deployment::latest_revision].
    pub fn set_latest_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.latest_revision = v.into();
        self
    }

    /// Sets the value of [state_detail][crate::model::Deployment::state_detail].
    pub fn set_state_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.state_detail = v.into();
        self
    }

    /// Sets the value of [error_code][crate::model::Deployment::error_code].
    pub fn set_error_code<T: std::convert::Into<crate::model::deployment::ErrorCode>>(
        mut self,
        v: T,
    ) -> Self {
        self.error_code = v.into();
        self
    }

    /// Sets the value of [delete_results][crate::model::Deployment::delete_results].
    pub fn set_delete_results<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ApplyResults>,
    {
        self.delete_results = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [delete_results][crate::model::Deployment::delete_results].
    pub fn set_or_clear_delete_results<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ApplyResults>,
    {
        self.delete_results = v.map(|x| x.into());
        self
    }

    /// Sets the value of [delete_build][crate::model::Deployment::delete_build].
    pub fn set_delete_build<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.delete_build = v.into();
        self
    }

    /// Sets the value of [delete_logs][crate::model::Deployment::delete_logs].
    pub fn set_delete_logs<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.delete_logs = v.into();
        self
    }

    /// Sets the value of [tf_errors][crate::model::Deployment::tf_errors].
    pub fn set_tf_errors<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::TerraformError>,
    {
        use std::iter::Iterator;
        self.tf_errors = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [error_logs][crate::model::Deployment::error_logs].
    pub fn set_error_logs<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.error_logs = v.into();
        self
    }

    /// Sets the value of [artifacts_gcs_bucket][crate::model::Deployment::artifacts_gcs_bucket].
    pub fn set_artifacts_gcs_bucket<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<std::string::String>,
    {
        self.artifacts_gcs_bucket = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [artifacts_gcs_bucket][crate::model::Deployment::artifacts_gcs_bucket].
    pub fn set_or_clear_artifacts_gcs_bucket<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<std::string::String>,
    {
        self.artifacts_gcs_bucket = v.map(|x| x.into());
        self
    }

    /// Sets the value of [service_account][crate::model::Deployment::service_account].
    pub fn set_service_account<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<std::string::String>,
    {
        self.service_account = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [service_account][crate::model::Deployment::service_account].
    pub fn set_or_clear_service_account<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<std::string::String>,
    {
        self.service_account = v.map(|x| x.into());
        self
    }

    /// Sets the value of [import_existing_resources][crate::model::Deployment::import_existing_resources].
    pub fn set_import_existing_resources<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<bool>,
    {
        self.import_existing_resources = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [import_existing_resources][crate::model::Deployment::import_existing_resources].
    pub fn set_or_clear_import_existing_resources<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<bool>,
    {
        self.import_existing_resources = v.map(|x| x.into());
        self
    }

    /// Sets the value of [worker_pool][crate::model::Deployment::worker_pool].
    pub fn set_worker_pool<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<std::string::String>,
    {
        self.worker_pool = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [worker_pool][crate::model::Deployment::worker_pool].
    pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<std::string::String>,
    {
        self.worker_pool = v.map(|x| x.into());
        self
    }

    /// Sets the value of [lock_state][crate::model::Deployment::lock_state].
    pub fn set_lock_state<T: std::convert::Into<crate::model::deployment::LockState>>(
        mut self,
        v: T,
    ) -> Self {
        self.lock_state = v.into();
        self
    }

    /// Sets the value of [tf_version_constraint][crate::model::Deployment::tf_version_constraint].
    pub fn set_tf_version_constraint<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<std::string::String>,
    {
        self.tf_version_constraint = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [tf_version_constraint][crate::model::Deployment::tf_version_constraint].
    pub fn set_or_clear_tf_version_constraint<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<std::string::String>,
    {
        self.tf_version_constraint = v.map(|x| x.into());
        self
    }

    /// Sets the value of [tf_version][crate::model::Deployment::tf_version].
    pub fn set_tf_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.tf_version = v.into();
        self
    }

    /// Sets the value of [quota_validation][crate::model::Deployment::quota_validation].
    pub fn set_quota_validation<T: std::convert::Into<crate::model::QuotaValidation>>(
        mut self,
        v: T,
    ) -> Self {
        self.quota_validation = v.into();
        self
    }

    /// Sets the value of [annotations][crate::model::Deployment::annotations].
    pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [provider_config][crate::model::Deployment::provider_config].
    pub fn set_provider_config<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ProviderConfig>,
    {
        self.provider_config = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [provider_config][crate::model::Deployment::provider_config].
    pub fn set_or_clear_provider_config<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ProviderConfig>,
    {
        self.provider_config = v.map(|x| x.into());
        self
    }

    /// Sets the value of [blueprint][crate::model::Deployment::blueprint].
    ///
    /// Note that all the setters affecting `blueprint` are mutually
    /// exclusive.
    pub fn set_blueprint<
        T: std::convert::Into<std::option::Option<crate::model::deployment::Blueprint>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.blueprint = v.into();
        self
    }

    /// The value of [blueprint][crate::model::Deployment::blueprint]
    /// if it holds a `TerraformBlueprint`, `None` if the field is not set or
    /// holds a different branch.
    pub fn terraform_blueprint(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::TerraformBlueprint>> {
        #[allow(unreachable_patterns)]
        self.blueprint.as_ref().and_then(|v| match v {
            crate::model::deployment::Blueprint::TerraformBlueprint(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [blueprint][crate::model::Deployment::blueprint]
    /// to hold a `TerraformBlueprint`.
    ///
    /// Note that all the setters affecting `blueprint` are
    /// mutually exclusive.
    pub fn set_terraform_blueprint<
        T: std::convert::Into<std::boxed::Box<crate::model::TerraformBlueprint>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.blueprint = std::option::Option::Some(
            crate::model::deployment::Blueprint::TerraformBlueprint(v.into()),
        );
        self
    }
}

impl wkt::message::Message for Deployment {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.Deployment"
    }
}

/// Defines additional types related to [Deployment].
pub mod deployment {
    #[allow(unused_imports)]
    use super::*;

    /// Possible states of a deployment.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// The default value. This value is used if the state is omitted.
        Unspecified,
        /// The deployment is being created.
        Creating,
        /// The deployment is healthy.
        Active,
        /// The deployment is being updated.
        Updating,
        /// The deployment is being deleted.
        Deleting,
        /// The deployment has encountered an unexpected error.
        Failed,
        /// The deployment is no longer being actively reconciled.
        /// This may be the result of recovering the project after deletion.
        Suspended,
        /// The deployment has been deleted.
        Deleted,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Creating => std::option::Option::Some(1),
                Self::Active => std::option::Option::Some(2),
                Self::Updating => std::option::Option::Some(3),
                Self::Deleting => std::option::Option::Some(4),
                Self::Failed => std::option::Option::Some(5),
                Self::Suspended => std::option::Option::Some(6),
                Self::Deleted => std::option::Option::Some(7),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Creating => std::option::Option::Some("CREATING"),
                Self::Active => std::option::Option::Some("ACTIVE"),
                Self::Updating => std::option::Option::Some("UPDATING"),
                Self::Deleting => std::option::Option::Some("DELETING"),
                Self::Failed => std::option::Option::Some("FAILED"),
                Self::Suspended => std::option::Option::Some("SUSPENDED"),
                Self::Deleted => std::option::Option::Some("DELETED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Creating,
                2 => Self::Active,
                3 => Self::Updating,
                4 => Self::Deleting,
                5 => Self::Failed,
                6 => Self::Suspended,
                7 => Self::Deleted,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "CREATING" => Self::Creating,
                "ACTIVE" => Self::Active,
                "UPDATING" => Self::Updating,
                "DELETING" => Self::Deleting,
                "FAILED" => Self::Failed,
                "SUSPENDED" => Self::Suspended,
                "DELETED" => Self::Deleted,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Creating => serializer.serialize_i32(1),
                Self::Active => serializer.serialize_i32(2),
                Self::Updating => serializer.serialize_i32(3),
                Self::Deleting => serializer.serialize_i32(4),
                Self::Failed => serializer.serialize_i32(5),
                Self::Suspended => serializer.serialize_i32(6),
                Self::Deleted => serializer.serialize_i32(7),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.config.v1.Deployment.State",
            ))
        }
    }

    /// Possible errors that can occur with deployments.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum ErrorCode {
        /// No error code was specified.
        Unspecified,
        /// The revision failed. See Revision for more details.
        RevisionFailed,
        /// Cloud Build failed due to a permission issue.
        CloudBuildPermissionDenied,
        /// Cloud Build job associated with a deployment deletion could not be
        /// started.
        DeleteBuildApiFailed,
        /// Cloud Build job associated with a deployment deletion was started but
        /// failed.
        DeleteBuildRunFailed,
        /// Cloud Storage bucket creation failed due to a permission issue.
        BucketCreationPermissionDenied,
        /// Cloud Storage bucket creation failed due to an issue unrelated to
        /// permissions.
        BucketCreationFailed,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [ErrorCode::value] or
        /// [ErrorCode::name].
        UnknownValue(error_code::UnknownValue),
    }

    #[doc(hidden)]
    pub mod error_code {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl ErrorCode {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::RevisionFailed => std::option::Option::Some(1),
                Self::CloudBuildPermissionDenied => std::option::Option::Some(3),
                Self::DeleteBuildApiFailed => std::option::Option::Some(5),
                Self::DeleteBuildRunFailed => std::option::Option::Some(6),
                Self::BucketCreationPermissionDenied => std::option::Option::Some(7),
                Self::BucketCreationFailed => std::option::Option::Some(8),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("ERROR_CODE_UNSPECIFIED"),
                Self::RevisionFailed => std::option::Option::Some("REVISION_FAILED"),
                Self::CloudBuildPermissionDenied => {
                    std::option::Option::Some("CLOUD_BUILD_PERMISSION_DENIED")
                }
                Self::DeleteBuildApiFailed => std::option::Option::Some("DELETE_BUILD_API_FAILED"),
                Self::DeleteBuildRunFailed => std::option::Option::Some("DELETE_BUILD_RUN_FAILED"),
                Self::BucketCreationPermissionDenied => {
                    std::option::Option::Some("BUCKET_CREATION_PERMISSION_DENIED")
                }
                Self::BucketCreationFailed => std::option::Option::Some("BUCKET_CREATION_FAILED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for ErrorCode {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for ErrorCode {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for ErrorCode {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::RevisionFailed,
                3 => Self::CloudBuildPermissionDenied,
                5 => Self::DeleteBuildApiFailed,
                6 => Self::DeleteBuildRunFailed,
                7 => Self::BucketCreationPermissionDenied,
                8 => Self::BucketCreationFailed,
                _ => Self::UnknownValue(error_code::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for ErrorCode {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "ERROR_CODE_UNSPECIFIED" => Self::Unspecified,
                "REVISION_FAILED" => Self::RevisionFailed,
                "CLOUD_BUILD_PERMISSION_DENIED" => Self::CloudBuildPermissionDenied,
                "DELETE_BUILD_API_FAILED" => Self::DeleteBuildApiFailed,
                "DELETE_BUILD_RUN_FAILED" => Self::DeleteBuildRunFailed,
                "BUCKET_CREATION_PERMISSION_DENIED" => Self::BucketCreationPermissionDenied,
                "BUCKET_CREATION_FAILED" => Self::BucketCreationFailed,
                _ => Self::UnknownValue(error_code::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for ErrorCode {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::RevisionFailed => serializer.serialize_i32(1),
                Self::CloudBuildPermissionDenied => serializer.serialize_i32(3),
                Self::DeleteBuildApiFailed => serializer.serialize_i32(5),
                Self::DeleteBuildRunFailed => serializer.serialize_i32(6),
                Self::BucketCreationPermissionDenied => serializer.serialize_i32(7),
                Self::BucketCreationFailed => serializer.serialize_i32(8),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for ErrorCode {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ErrorCode>::new(
                ".google.cloud.config.v1.Deployment.ErrorCode",
            ))
        }
    }

    /// Possible lock states of a deployment.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum LockState {
        /// The default value. This value is used if the lock state is omitted.
        Unspecified,
        /// The deployment is locked.
        Locked,
        /// The deployment is unlocked.
        Unlocked,
        /// The deployment is being locked.
        Locking,
        /// The deployment is being unlocked.
        Unlocking,
        /// The deployment has failed to lock.
        LockFailed,
        /// The deployment has failed to unlock.
        UnlockFailed,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [LockState::value] or
        /// [LockState::name].
        UnknownValue(lock_state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod lock_state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl LockState {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Locked => std::option::Option::Some(1),
                Self::Unlocked => std::option::Option::Some(2),
                Self::Locking => std::option::Option::Some(3),
                Self::Unlocking => std::option::Option::Some(4),
                Self::LockFailed => std::option::Option::Some(5),
                Self::UnlockFailed => std::option::Option::Some(6),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("LOCK_STATE_UNSPECIFIED"),
                Self::Locked => std::option::Option::Some("LOCKED"),
                Self::Unlocked => std::option::Option::Some("UNLOCKED"),
                Self::Locking => std::option::Option::Some("LOCKING"),
                Self::Unlocking => std::option::Option::Some("UNLOCKING"),
                Self::LockFailed => std::option::Option::Some("LOCK_FAILED"),
                Self::UnlockFailed => std::option::Option::Some("UNLOCK_FAILED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for LockState {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for LockState {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for LockState {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Locked,
                2 => Self::Unlocked,
                3 => Self::Locking,
                4 => Self::Unlocking,
                5 => Self::LockFailed,
                6 => Self::UnlockFailed,
                _ => Self::UnknownValue(lock_state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for LockState {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "LOCK_STATE_UNSPECIFIED" => Self::Unspecified,
                "LOCKED" => Self::Locked,
                "UNLOCKED" => Self::Unlocked,
                "LOCKING" => Self::Locking,
                "UNLOCKING" => Self::Unlocking,
                "LOCK_FAILED" => Self::LockFailed,
                "UNLOCK_FAILED" => Self::UnlockFailed,
                _ => Self::UnknownValue(lock_state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for LockState {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Locked => serializer.serialize_i32(1),
                Self::Unlocked => serializer.serialize_i32(2),
                Self::Locking => serializer.serialize_i32(3),
                Self::Unlocking => serializer.serialize_i32(4),
                Self::LockFailed => serializer.serialize_i32(5),
                Self::UnlockFailed => serializer.serialize_i32(6),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for LockState {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<LockState>::new(
                ".google.cloud.config.v1.Deployment.LockState",
            ))
        }
    }

    /// Blueprint to deploy.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Blueprint {
        /// A blueprint described using Terraform's HashiCorp Configuration Language
        /// as a root module.
        TerraformBlueprint(std::boxed::Box<crate::model::TerraformBlueprint>),
    }
}

/// TerraformBlueprint describes the source of a Terraform root module which
/// describes the resources and configs to be deployed.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TerraformBlueprint {
    /// Optional. Input variable values for the Terraform blueprint.
    pub input_values:
        std::collections::HashMap<std::string::String, crate::model::TerraformVariable>,

    /// Location of the source configs.
    /// Required.
    pub source: std::option::Option<crate::model::terraform_blueprint::Source>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl TerraformBlueprint {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [input_values][crate::model::TerraformBlueprint::input_values].
    pub fn set_input_values<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<crate::model::TerraformVariable>,
    {
        use std::iter::Iterator;
        self.input_values = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [source][crate::model::TerraformBlueprint::source].
    ///
    /// Note that all the setters affecting `source` are mutually
    /// exclusive.
    pub fn set_source<
        T: std::convert::Into<std::option::Option<crate::model::terraform_blueprint::Source>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.source = v.into();
        self
    }

    /// The value of [source][crate::model::TerraformBlueprint::source]
    /// if it holds a `GcsSource`, `None` if the field is not set or
    /// holds a different branch.
    pub fn gcs_source(&self) -> std::option::Option<&std::string::String> {
        #[allow(unreachable_patterns)]
        self.source.as_ref().and_then(|v| match v {
            crate::model::terraform_blueprint::Source::GcsSource(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [source][crate::model::TerraformBlueprint::source]
    /// to hold a `GcsSource`.
    ///
    /// Note that all the setters affecting `source` are
    /// mutually exclusive.
    pub fn set_gcs_source<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.source = std::option::Option::Some(
            crate::model::terraform_blueprint::Source::GcsSource(v.into()),
        );
        self
    }

    /// The value of [source][crate::model::TerraformBlueprint::source]
    /// if it holds a `GitSource`, `None` if the field is not set or
    /// holds a different branch.
    pub fn git_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::GitSource>> {
        #[allow(unreachable_patterns)]
        self.source.as_ref().and_then(|v| match v {
            crate::model::terraform_blueprint::Source::GitSource(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [source][crate::model::TerraformBlueprint::source]
    /// to hold a `GitSource`.
    ///
    /// Note that all the setters affecting `source` are
    /// mutually exclusive.
    pub fn set_git_source<T: std::convert::Into<std::boxed::Box<crate::model::GitSource>>>(
        mut self,
        v: T,
    ) -> Self {
        self.source = std::option::Option::Some(
            crate::model::terraform_blueprint::Source::GitSource(v.into()),
        );
        self
    }
}

impl wkt::message::Message for TerraformBlueprint {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.TerraformBlueprint"
    }
}

/// Defines additional types related to [TerraformBlueprint].
pub mod terraform_blueprint {
    #[allow(unused_imports)]
    use super::*;

    /// Location of the source configs.
    /// Required.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Source {
        /// URI of an object in Google Cloud Storage.
        /// Format: `gs://{bucket}/{object}`
        ///
        /// URI may also specify an object version for zipped objects.
        /// Format: `gs://{bucket}/{object}#{version}`
        GcsSource(std::string::String),
        /// URI of a public Git repo.
        GitSource(std::boxed::Box<crate::model::GitSource>),
    }
}

/// A Terraform input variable.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TerraformVariable {
    /// Optional. Input variable value.
    pub input_value: std::option::Option<wkt::Value>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl TerraformVariable {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [input_value][crate::model::TerraformVariable::input_value].
    pub fn set_input_value<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Value>,
    {
        self.input_value = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [input_value][crate::model::TerraformVariable::input_value].
    pub fn set_or_clear_input_value<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Value>,
    {
        self.input_value = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for TerraformVariable {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.TerraformVariable"
    }
}

/// Outputs and artifacts from applying a deployment.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ApplyResults {
    /// Location of a blueprint copy and other manifests in Google Cloud Storage.
    /// Format: `gs://{bucket}/{object}`
    pub content: std::string::String,

    /// Location of artifacts (e.g. logs) in Google Cloud Storage.
    /// Format: `gs://{bucket}/{object}`
    pub artifacts: std::string::String,

    /// Map of output name to output info.
    pub outputs: std::collections::HashMap<std::string::String, crate::model::TerraformOutput>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ApplyResults {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [content][crate::model::ApplyResults::content].
    pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.content = v.into();
        self
    }

    /// Sets the value of [artifacts][crate::model::ApplyResults::artifacts].
    pub fn set_artifacts<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.artifacts = v.into();
        self
    }

    /// Sets the value of [outputs][crate::model::ApplyResults::outputs].
    pub fn set_outputs<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<crate::model::TerraformOutput>,
    {
        use std::iter::Iterator;
        self.outputs = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for ApplyResults {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.ApplyResults"
    }
}

/// Describes a Terraform output.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TerraformOutput {
    /// Identifies whether Terraform has set this output as a potential
    /// sensitive value.
    pub sensitive: bool,

    /// Value of output.
    pub value: std::option::Option<wkt::Value>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl TerraformOutput {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [sensitive][crate::model::TerraformOutput::sensitive].
    pub fn set_sensitive<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.sensitive = v.into();
        self
    }

    /// Sets the value of [value][crate::model::TerraformOutput::value].
    pub fn set_value<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Value>,
    {
        self.value = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [value][crate::model::TerraformOutput::value].
    pub fn set_or_clear_value<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Value>,
    {
        self.value = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for TerraformOutput {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.TerraformOutput"
    }
}

#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListDeploymentsRequest {
    /// Required. The parent in whose context the Deployments are listed. The
    /// parent value is in the format:
    /// 'projects/{project_id}/locations/{location}'.
    pub parent: std::string::String,

    /// When requesting a page of resources, 'page_size' specifies number of
    /// resources to return. If unspecified, at most 500 will be returned. The
    /// maximum value is 1000.
    pub page_size: i32,

    /// Token returned by previous call to 'ListDeployments' which specifies the
    /// position in the list from where to continue listing the resources.
    pub page_token: std::string::String,

    /// Lists the Deployments that match the filter expression. A filter
    /// expression filters the resources listed in the response. The expression
    /// must be of the form '{field} {operator} {value}' where operators: '<', '>',
    /// '<=', '>=', '!=', '=', ':' are supported (colon ':' represents a HAS
    /// operator which is roughly synonymous with equality). {field} can refer to a
    /// proto or JSON field, or a synthetic field. Field names can be camelCase or
    /// snake_case.
    ///
    /// Examples:
    ///
    /// - Filter by name:
    ///   name = "projects/foo/locations/us-central1/deployments/bar
    ///
    /// - Filter by labels:
    ///
    ///   - Resources that have a key called 'foo'
    ///     labels.foo:*
    ///   - Resources that have a key called 'foo' whose value is 'bar'
    ///     labels.foo = bar
    /// - Filter by state:
    ///
    ///   - Deployments in CREATING state.
    ///     state=CREATING
    pub filter: std::string::String,

    /// Field to use to sort the list.
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListDeploymentsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListDeploymentsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListDeploymentsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListDeploymentsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListDeploymentsRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListDeploymentsRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListDeploymentsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.ListDeploymentsRequest"
    }
}

#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListDeploymentsResponse {
    /// List of [Deployment][google.cloud.config.v1.Deployment]s.
    ///
    /// [google.cloud.config.v1.Deployment]: crate::model::Deployment
    pub deployments: std::vec::Vec<crate::model::Deployment>,

    /// Token to be supplied to the next ListDeployments request via `page_token`
    /// to obtain the next set of results.
    pub next_page_token: std::string::String,

    /// Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListDeploymentsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [deployments][crate::model::ListDeploymentsResponse::deployments].
    pub fn set_deployments<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Deployment>,
    {
        use std::iter::Iterator;
        self.deployments = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListDeploymentsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListDeploymentsResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListDeploymentsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.ListDeploymentsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListDeploymentsResponse {
    type PageItem = crate::model::Deployment;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.deployments
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetDeploymentRequest {
    /// Required. The name of the deployment. Format:
    /// 'projects/{project_id}/locations/{location}/deployments/{deployment}'.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetDeploymentRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetDeploymentRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetDeploymentRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.GetDeploymentRequest"
    }
}

/// A request to list Revisions passed to a 'ListRevisions' call.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRevisionsRequest {
    /// Required. The parent in whose context the Revisions are listed. The parent
    /// value is in the format:
    /// 'projects/{project_id}/locations/{location}/deployments/{deployment}'.
    pub parent: std::string::String,

    /// When requesting a page of resources, `page_size` specifies number of
    /// resources to return. If unspecified, at most 500 will be returned. The
    /// maximum value is 1000.
    pub page_size: i32,

    /// Token returned by previous call to 'ListRevisions' which specifies the
    /// position in the list from where to continue listing the resources.
    pub page_token: std::string::String,

    /// Lists the Revisions that match the filter expression. A filter
    /// expression filters the resources listed in the response. The expression
    /// must be of the form '{field} {operator} {value}' where operators: '<', '>',
    /// '<=', '>=', '!=', '=', ':' are supported (colon ':' represents a HAS
    /// operator which is roughly synonymous with equality). {field} can refer to a
    /// proto or JSON field, or a synthetic field. Field names can be camelCase or
    /// snake_case.
    ///
    /// Examples:
    ///
    /// - Filter by name:
    ///   name = "projects/foo/locations/us-central1/deployments/dep/revisions/bar
    ///
    /// - Filter by labels:
    ///
    ///   - Resources that have a key called 'foo'
    ///     labels.foo:*
    ///   - Resources that have a key called 'foo' whose value is 'bar'
    ///     labels.foo = bar
    /// - Filter by state:
    ///
    ///   - Revisions in CREATING state.
    ///     state=CREATING
    pub filter: std::string::String,

    /// Field to use to sort the list.
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListRevisionsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListRevisionsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListRevisionsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListRevisionsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListRevisionsRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListRevisionsRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListRevisionsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.ListRevisionsRequest"
    }
}

/// A response to a 'ListRevisions' call. Contains a list of Revisions.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRevisionsResponse {
    /// List of [Revision][google.cloud.config.v1.Revision]s.
    ///
    /// [google.cloud.config.v1.Revision]: crate::model::Revision
    pub revisions: std::vec::Vec<crate::model::Revision>,

    /// A token to request the next page of resources from the 'ListRevisions'
    /// method. The value of an empty string means that there are no more resources
    /// to return.
    pub next_page_token: std::string::String,

    /// Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListRevisionsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [revisions][crate::model::ListRevisionsResponse::revisions].
    pub fn set_revisions<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Revision>,
    {
        use std::iter::Iterator;
        self.revisions = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListRevisionsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListRevisionsResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListRevisionsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.ListRevisionsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListRevisionsResponse {
    type PageItem = crate::model::Revision;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.revisions
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// A request to get a Revision from a 'GetRevision' call.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetRevisionRequest {
    /// Required. The name of the Revision in the format:
    /// 'projects/{project_id}/locations/{location}/deployments/{deployment}/revisions/{revision}'.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetRevisionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetRevisionRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetRevisionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.GetRevisionRequest"
    }
}

#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateDeploymentRequest {
    /// Required. The parent in whose context the Deployment is created. The parent
    /// value is in the format: 'projects/{project_id}/locations/{location}'.
    pub parent: std::string::String,

    /// Required. The Deployment ID.
    pub deployment_id: std::string::String,

    /// Required. [Deployment][google.cloud.config.v1.Deployment] resource to be
    /// created.
    ///
    /// [google.cloud.config.v1.Deployment]: crate::model::Deployment
    pub deployment: std::option::Option<crate::model::Deployment>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request ID,
    /// the server can check if original operation with the same request ID was
    /// received, and if so, will ignore the second request. This prevents clients
    /// from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateDeploymentRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateDeploymentRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [deployment_id][crate::model::CreateDeploymentRequest::deployment_id].
    pub fn set_deployment_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.deployment_id = v.into();
        self
    }

    /// Sets the value of [deployment][crate::model::CreateDeploymentRequest::deployment].
    pub fn set_deployment<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Deployment>,
    {
        self.deployment = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [deployment][crate::model::CreateDeploymentRequest::deployment].
    pub fn set_or_clear_deployment<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Deployment>,
    {
        self.deployment = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::CreateDeploymentRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for CreateDeploymentRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.CreateDeploymentRequest"
    }
}

#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateDeploymentRequest {
    /// Optional. Field mask used to specify the fields to be overwritten in the
    /// Deployment resource by the update.
    ///
    /// The fields specified in the update_mask are relative to the resource, not
    /// the full request. A field will be overwritten if it is in the mask. If the
    /// user does not provide a mask then all fields will be overwritten.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Required. [Deployment][google.cloud.config.v1.Deployment] to update.
    ///
    /// The deployment's `name` field is used to identify the resource to be
    /// updated. Format:
    /// `projects/{project}/locations/{location}/deployments/{deployment}`
    ///
    /// [google.cloud.config.v1.Deployment]: crate::model::Deployment
    pub deployment: std::option::Option<crate::model::Deployment>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request ID,
    /// the server can check if original operation with the same request ID was
    /// received, and if so, will ignore the second request. This prevents clients
    /// from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateDeploymentRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [update_mask][crate::model::UpdateDeploymentRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateDeploymentRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [deployment][crate::model::UpdateDeploymentRequest::deployment].
    pub fn set_deployment<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Deployment>,
    {
        self.deployment = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [deployment][crate::model::UpdateDeploymentRequest::deployment].
    pub fn set_or_clear_deployment<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Deployment>,
    {
        self.deployment = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::UpdateDeploymentRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for UpdateDeploymentRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.UpdateDeploymentRequest"
    }
}

#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteDeploymentRequest {
    /// Required. The name of the Deployment in the format:
    /// 'projects/{project_id}/locations/{location}/deployments/{deployment}'.
    pub name: std::string::String,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes after the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request ID,
    /// the server can check if original operation with the same request ID was
    /// received, and if so, will ignore the second request. This prevents clients
    /// from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    /// Optional. If set to true, any revisions for this deployment will also be
    /// deleted. (Otherwise, the request will only work if the deployment has no
    /// revisions.)
    pub force: bool,

    /// Optional. Policy on how resources actuated by the deployment should be
    /// deleted. If unspecified, the default behavior is to delete the underlying
    /// resources.
    pub delete_policy: crate::model::delete_deployment_request::DeletePolicy,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteDeploymentRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteDeploymentRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [request_id][crate::model::DeleteDeploymentRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }

    /// Sets the value of [force][crate::model::DeleteDeploymentRequest::force].
    pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.force = v.into();
        self
    }

    /// Sets the value of [delete_policy][crate::model::DeleteDeploymentRequest::delete_policy].
    pub fn set_delete_policy<
        T: std::convert::Into<crate::model::delete_deployment_request::DeletePolicy>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.delete_policy = v.into();
        self
    }
}

impl wkt::message::Message for DeleteDeploymentRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.DeleteDeploymentRequest"
    }
}

/// Defines additional types related to [DeleteDeploymentRequest].
pub mod delete_deployment_request {
    #[allow(unused_imports)]
    use super::*;

    /// Policy on how resources actuated by the deployment should be deleted.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum DeletePolicy {
        /// Unspecified policy, resources will be deleted.
        Unspecified,
        /// Deletes resources actuated by the deployment.
        Delete,
        /// Abandons resources and only deletes the deployment and its metadata.
        Abandon,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [DeletePolicy::value] or
        /// [DeletePolicy::name].
        UnknownValue(delete_policy::UnknownValue),
    }

    #[doc(hidden)]
    pub mod delete_policy {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl DeletePolicy {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Delete => std::option::Option::Some(1),
                Self::Abandon => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("DELETE_POLICY_UNSPECIFIED"),
                Self::Delete => std::option::Option::Some("DELETE"),
                Self::Abandon => std::option::Option::Some("ABANDON"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for DeletePolicy {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for DeletePolicy {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for DeletePolicy {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Delete,
                2 => Self::Abandon,
                _ => Self::UnknownValue(delete_policy::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for DeletePolicy {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "DELETE_POLICY_UNSPECIFIED" => Self::Unspecified,
                "DELETE" => Self::Delete,
                "ABANDON" => Self::Abandon,
                _ => Self::UnknownValue(delete_policy::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for DeletePolicy {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Delete => serializer.serialize_i32(1),
                Self::Abandon => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for DeletePolicy {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<DeletePolicy>::new(
                ".google.cloud.config.v1.DeleteDeploymentRequest.DeletePolicy",
            ))
        }
    }
}

/// Represents the metadata of the long-running operation.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OperationMetadata {
    /// Output only. Time when the operation was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Time when the operation finished running.
    pub end_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Server-defined resource path for the target of the operation.
    pub target: std::string::String,

    /// Output only. Name of the verb executed by the operation.
    pub verb: std::string::String,

    /// Output only. Human-readable status of the operation, if any.
    pub status_message: std::string::String,

    /// Output only. Identifies whether the user has requested cancellation of the
    /// operation. Operations that have successfully been cancelled have
    /// [google.longrunning.Operation.error][google.longrunning.Operation.error]
    /// value with a [google.rpc.Status.code][google.rpc.Status.code] of `1`,
    /// corresponding to `Code.CANCELLED`.
    ///
    /// [google.longrunning.Operation.error]: longrunning::model::Operation::result
    /// [google.rpc.Status.code]: rpc::model::Status::code
    pub requested_cancellation: bool,

    /// Output only. API version used to start the operation.
    pub api_version: std::string::String,

    /// Ephemeral metadata about the state of an operation for a particular
    /// resource.
    pub resource_metadata: std::option::Option<crate::model::operation_metadata::ResourceMetadata>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl OperationMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
    pub fn set_end_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [target][crate::model::OperationMetadata::target].
    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.target = v.into();
        self
    }

    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.verb = v.into();
        self
    }

    /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
    pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.status_message = v.into();
        self
    }

    /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
    pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.requested_cancellation = v.into();
        self
    }

    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.api_version = v.into();
        self
    }

    /// Sets the value of [resource_metadata][crate::model::OperationMetadata::resource_metadata].
    ///
    /// Note that all the setters affecting `resource_metadata` are mutually
    /// exclusive.
    pub fn set_resource_metadata<
        T: std::convert::Into<std::option::Option<crate::model::operation_metadata::ResourceMetadata>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.resource_metadata = v.into();
        self
    }

    /// The value of [resource_metadata][crate::model::OperationMetadata::resource_metadata]
    /// if it holds a `DeploymentMetadata`, `None` if the field is not set or
    /// holds a different branch.
    pub fn deployment_metadata(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::DeploymentOperationMetadata>> {
        #[allow(unreachable_patterns)]
        self.resource_metadata.as_ref().and_then(|v| match v {
            crate::model::operation_metadata::ResourceMetadata::DeploymentMetadata(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [resource_metadata][crate::model::OperationMetadata::resource_metadata]
    /// to hold a `DeploymentMetadata`.
    ///
    /// Note that all the setters affecting `resource_metadata` are
    /// mutually exclusive.
    pub fn set_deployment_metadata<
        T: std::convert::Into<std::boxed::Box<crate::model::DeploymentOperationMetadata>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.resource_metadata = std::option::Option::Some(
            crate::model::operation_metadata::ResourceMetadata::DeploymentMetadata(v.into()),
        );
        self
    }

    /// The value of [resource_metadata][crate::model::OperationMetadata::resource_metadata]
    /// if it holds a `PreviewMetadata`, `None` if the field is not set or
    /// holds a different branch.
    pub fn preview_metadata(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::PreviewOperationMetadata>> {
        #[allow(unreachable_patterns)]
        self.resource_metadata.as_ref().and_then(|v| match v {
            crate::model::operation_metadata::ResourceMetadata::PreviewMetadata(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [resource_metadata][crate::model::OperationMetadata::resource_metadata]
    /// to hold a `PreviewMetadata`.
    ///
    /// Note that all the setters affecting `resource_metadata` are
    /// mutually exclusive.
    pub fn set_preview_metadata<
        T: std::convert::Into<std::boxed::Box<crate::model::PreviewOperationMetadata>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.resource_metadata = std::option::Option::Some(
            crate::model::operation_metadata::ResourceMetadata::PreviewMetadata(v.into()),
        );
        self
    }
}

impl wkt::message::Message for OperationMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.OperationMetadata"
    }
}

/// Defines additional types related to [OperationMetadata].
pub mod operation_metadata {
    #[allow(unused_imports)]
    use super::*;

    /// Ephemeral metadata about the state of an operation for a particular
    /// resource.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum ResourceMetadata {
        /// Output only. Metadata about the deployment operation state.
        DeploymentMetadata(std::boxed::Box<crate::model::DeploymentOperationMetadata>),
        /// Output only. Metadata about the preview operation state.
        PreviewMetadata(std::boxed::Box<crate::model::PreviewOperationMetadata>),
    }
}

/// A child resource of a Deployment generated by a 'CreateDeployment' or
/// 'UpdateDeployment' call. Each Revision contains metadata pertaining to a
/// snapshot of a particular Deployment.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Revision {
    /// Revision name. Format:
    /// `projects/{project}/locations/{location}/deployments/{deployment}/
    /// revisions/{revision}`
    pub name: std::string::String,

    /// Output only. Time when the revision was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Time when the revision was last modified.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The action which created this revision
    pub action: crate::model::revision::Action,

    /// Output only. Current state of the revision.
    pub state: crate::model::revision::State,

    /// Output only. Outputs and artifacts from applying a deployment.
    pub apply_results: std::option::Option<crate::model::ApplyResults>,

    /// Output only. Additional info regarding the current state.
    pub state_detail: std::string::String,

    /// Output only. Code describing any errors that may have occurred.
    pub error_code: crate::model::revision::ErrorCode,

    /// Output only. Cloud Build instance UUID associated with this revision.
    pub build: std::string::String,

    /// Output only. Location of Revision operation logs in
    /// `gs://{bucket}/{object}` format.
    pub logs: std::string::String,

    /// Output only. Errors encountered when creating or updating this deployment.
    /// Errors are truncated to 10 entries, see `delete_results` and `error_logs`
    /// for full details.
    pub tf_errors: std::vec::Vec<crate::model::TerraformError>,

    /// Output only. Location of Terraform error logs in Google Cloud Storage.
    /// Format: `gs://{bucket}/{object}`.
    pub error_logs: std::string::String,

    /// Output only. User-specified Service Account (SA) to be used as credential
    /// to manage resources. Format:
    /// `projects/{projectID}/serviceAccounts/{serviceAccount}`
    pub service_account: std::string::String,

    /// Output only. By default, Infra Manager will return a failure when
    /// Terraform encounters a 409 code (resource conflict error) during actuation.
    /// If this flag is set to true, Infra Manager will instead
    /// attempt to automatically import the resource into the Terraform state (for
    /// supported resource types) and continue actuation.
    ///
    /// Not all resource types are supported, refer to documentation.
    pub import_existing_resources: bool,

    /// Output only. The user-specified Cloud Build worker pool resource in which
    /// the Cloud Build job will execute. Format:
    /// `projects/{project}/locations/{location}/workerPools/{workerPoolId}`.
    /// If this field is unspecified, the default Cloud Build worker pool will be
    /// used.
    pub worker_pool: std::string::String,

    /// Output only. The user-specified Terraform version constraint.
    /// Example: "=1.3.10".
    pub tf_version_constraint: std::string::String,

    /// Output only. The version of Terraform used to create the Revision.
    /// It is in the format of "Major.Minor.Patch", for example, "1.3.10".
    pub tf_version: std::string::String,

    /// Output only. Cloud Storage path containing quota validation results. This
    /// field is set when a user sets Deployment.quota_validation field to ENABLED
    /// or ENFORCED. Format: `gs://{bucket}/{object}`.
    pub quota_validation_results: std::string::String,

    /// Optional. Input to control quota checks for resources in terraform
    /// configuration files. There are limited resources on which quota validation
    /// applies.
    pub quota_validation: crate::model::QuotaValidation,

    /// Output only. This field specifies the provider configurations.
    pub provider_config: std::option::Option<crate::model::ProviderConfig>,

    /// Blueprint that was deployed.
    pub blueprint: std::option::Option<crate::model::revision::Blueprint>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Revision {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Revision::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::Revision::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::Revision::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::Revision::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::Revision::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [action][crate::model::Revision::action].
    pub fn set_action<T: std::convert::Into<crate::model::revision::Action>>(
        mut self,
        v: T,
    ) -> Self {
        self.action = v.into();
        self
    }

    /// Sets the value of [state][crate::model::Revision::state].
    pub fn set_state<T: std::convert::Into<crate::model::revision::State>>(mut self, v: T) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [apply_results][crate::model::Revision::apply_results].
    pub fn set_apply_results<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ApplyResults>,
    {
        self.apply_results = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [apply_results][crate::model::Revision::apply_results].
    pub fn set_or_clear_apply_results<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ApplyResults>,
    {
        self.apply_results = v.map(|x| x.into());
        self
    }

    /// Sets the value of [state_detail][crate::model::Revision::state_detail].
    pub fn set_state_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.state_detail = v.into();
        self
    }

    /// Sets the value of [error_code][crate::model::Revision::error_code].
    pub fn set_error_code<T: std::convert::Into<crate::model::revision::ErrorCode>>(
        mut self,
        v: T,
    ) -> Self {
        self.error_code = v.into();
        self
    }

    /// Sets the value of [build][crate::model::Revision::build].
    pub fn set_build<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.build = v.into();
        self
    }

    /// Sets the value of [logs][crate::model::Revision::logs].
    pub fn set_logs<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.logs = v.into();
        self
    }

    /// Sets the value of [tf_errors][crate::model::Revision::tf_errors].
    pub fn set_tf_errors<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::TerraformError>,
    {
        use std::iter::Iterator;
        self.tf_errors = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [error_logs][crate::model::Revision::error_logs].
    pub fn set_error_logs<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.error_logs = v.into();
        self
    }

    /// Sets the value of [service_account][crate::model::Revision::service_account].
    pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.service_account = v.into();
        self
    }

    /// Sets the value of [import_existing_resources][crate::model::Revision::import_existing_resources].
    pub fn set_import_existing_resources<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.import_existing_resources = v.into();
        self
    }

    /// Sets the value of [worker_pool][crate::model::Revision::worker_pool].
    pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.worker_pool = v.into();
        self
    }

    /// Sets the value of [tf_version_constraint][crate::model::Revision::tf_version_constraint].
    pub fn set_tf_version_constraint<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.tf_version_constraint = v.into();
        self
    }

    /// Sets the value of [tf_version][crate::model::Revision::tf_version].
    pub fn set_tf_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.tf_version = v.into();
        self
    }

    /// Sets the value of [quota_validation_results][crate::model::Revision::quota_validation_results].
    pub fn set_quota_validation_results<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.quota_validation_results = v.into();
        self
    }

    /// Sets the value of [quota_validation][crate::model::Revision::quota_validation].
    pub fn set_quota_validation<T: std::convert::Into<crate::model::QuotaValidation>>(
        mut self,
        v: T,
    ) -> Self {
        self.quota_validation = v.into();
        self
    }

    /// Sets the value of [provider_config][crate::model::Revision::provider_config].
    pub fn set_provider_config<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ProviderConfig>,
    {
        self.provider_config = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [provider_config][crate::model::Revision::provider_config].
    pub fn set_or_clear_provider_config<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ProviderConfig>,
    {
        self.provider_config = v.map(|x| x.into());
        self
    }

    /// Sets the value of [blueprint][crate::model::Revision::blueprint].
    ///
    /// Note that all the setters affecting `blueprint` are mutually
    /// exclusive.
    pub fn set_blueprint<
        T: std::convert::Into<std::option::Option<crate::model::revision::Blueprint>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.blueprint = v.into();
        self
    }

    /// The value of [blueprint][crate::model::Revision::blueprint]
    /// if it holds a `TerraformBlueprint`, `None` if the field is not set or
    /// holds a different branch.
    pub fn terraform_blueprint(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::TerraformBlueprint>> {
        #[allow(unreachable_patterns)]
        self.blueprint.as_ref().and_then(|v| match v {
            crate::model::revision::Blueprint::TerraformBlueprint(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [blueprint][crate::model::Revision::blueprint]
    /// to hold a `TerraformBlueprint`.
    ///
    /// Note that all the setters affecting `blueprint` are
    /// mutually exclusive.
    pub fn set_terraform_blueprint<
        T: std::convert::Into<std::boxed::Box<crate::model::TerraformBlueprint>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.blueprint = std::option::Option::Some(
            crate::model::revision::Blueprint::TerraformBlueprint(v.into()),
        );
        self
    }
}

impl wkt::message::Message for Revision {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.Revision"
    }
}

/// Defines additional types related to [Revision].
pub mod revision {
    #[allow(unused_imports)]
    use super::*;

    /// Actions that generate a revision.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Action {
        /// The default value. This value is used if the action is omitted.
        Unspecified,
        /// The revision was generated by creating a deployment.
        Create,
        /// The revision was generated by updating a deployment.
        Update,
        /// The revision was deleted.
        Delete,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [Action::value] or
        /// [Action::name].
        UnknownValue(action::UnknownValue),
    }

    #[doc(hidden)]
    pub mod action {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl Action {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Create => std::option::Option::Some(1),
                Self::Update => std::option::Option::Some(2),
                Self::Delete => std::option::Option::Some(3),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("ACTION_UNSPECIFIED"),
                Self::Create => std::option::Option::Some("CREATE"),
                Self::Update => std::option::Option::Some("UPDATE"),
                Self::Delete => std::option::Option::Some("DELETE"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for Action {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for Action {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for Action {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Create,
                2 => Self::Update,
                3 => Self::Delete,
                _ => Self::UnknownValue(action::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for Action {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "ACTION_UNSPECIFIED" => Self::Unspecified,
                "CREATE" => Self::Create,
                "UPDATE" => Self::Update,
                "DELETE" => Self::Delete,
                _ => Self::UnknownValue(action::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for Action {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Create => serializer.serialize_i32(1),
                Self::Update => serializer.serialize_i32(2),
                Self::Delete => serializer.serialize_i32(3),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for Action {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Action>::new(
                ".google.cloud.config.v1.Revision.Action",
            ))
        }
    }

    /// Possible states of a revision.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// The default value. This value is used if the state is omitted.
        Unspecified,
        /// The revision is being applied.
        Applying,
        /// The revision was applied successfully.
        Applied,
        /// The revision could not be applied successfully.
        Failed,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Applying => std::option::Option::Some(1),
                Self::Applied => std::option::Option::Some(2),
                Self::Failed => std::option::Option::Some(3),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Applying => std::option::Option::Some("APPLYING"),
                Self::Applied => std::option::Option::Some("APPLIED"),
                Self::Failed => std::option::Option::Some("FAILED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Applying,
                2 => Self::Applied,
                3 => Self::Failed,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "APPLYING" => Self::Applying,
                "APPLIED" => Self::Applied,
                "FAILED" => Self::Failed,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Applying => serializer.serialize_i32(1),
                Self::Applied => serializer.serialize_i32(2),
                Self::Failed => serializer.serialize_i32(3),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.config.v1.Revision.State",
            ))
        }
    }

    /// Possible errors if Revision could not be created or updated successfully.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum ErrorCode {
        /// No error code was specified.
        Unspecified,
        /// Cloud Build failed due to a permission issue.
        CloudBuildPermissionDenied,
        /// Cloud Build job associated with creating or updating a deployment could
        /// not be started.
        ApplyBuildApiFailed,
        /// Cloud Build job associated with creating or updating a deployment was
        /// started but failed.
        ApplyBuildRunFailed,
        /// quota validation failed for one or more resources in terraform
        /// configuration files.
        QuotaValidationFailed,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [ErrorCode::value] or
        /// [ErrorCode::name].
        UnknownValue(error_code::UnknownValue),
    }

    #[doc(hidden)]
    pub mod error_code {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl ErrorCode {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::CloudBuildPermissionDenied => std::option::Option::Some(1),
                Self::ApplyBuildApiFailed => std::option::Option::Some(4),
                Self::ApplyBuildRunFailed => std::option::Option::Some(5),
                Self::QuotaValidationFailed => std::option::Option::Some(7),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("ERROR_CODE_UNSPECIFIED"),
                Self::CloudBuildPermissionDenied => {
                    std::option::Option::Some("CLOUD_BUILD_PERMISSION_DENIED")
                }
                Self::ApplyBuildApiFailed => std::option::Option::Some("APPLY_BUILD_API_FAILED"),
                Self::ApplyBuildRunFailed => std::option::Option::Some("APPLY_BUILD_RUN_FAILED"),
                Self::QuotaValidationFailed => std::option::Option::Some("QUOTA_VALIDATION_FAILED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for ErrorCode {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for ErrorCode {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for ErrorCode {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::CloudBuildPermissionDenied,
                4 => Self::ApplyBuildApiFailed,
                5 => Self::ApplyBuildRunFailed,
                7 => Self::QuotaValidationFailed,
                _ => Self::UnknownValue(error_code::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for ErrorCode {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "ERROR_CODE_UNSPECIFIED" => Self::Unspecified,
                "CLOUD_BUILD_PERMISSION_DENIED" => Self::CloudBuildPermissionDenied,
                "APPLY_BUILD_API_FAILED" => Self::ApplyBuildApiFailed,
                "APPLY_BUILD_RUN_FAILED" => Self::ApplyBuildRunFailed,
                "QUOTA_VALIDATION_FAILED" => Self::QuotaValidationFailed,
                _ => Self::UnknownValue(error_code::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for ErrorCode {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::CloudBuildPermissionDenied => serializer.serialize_i32(1),
                Self::ApplyBuildApiFailed => serializer.serialize_i32(4),
                Self::ApplyBuildRunFailed => serializer.serialize_i32(5),
                Self::QuotaValidationFailed => serializer.serialize_i32(7),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for ErrorCode {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ErrorCode>::new(
                ".google.cloud.config.v1.Revision.ErrorCode",
            ))
        }
    }

    /// Blueprint that was deployed.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Blueprint {
        /// Output only. A blueprint described using Terraform's HashiCorp
        /// Configuration Language as a root module.
        TerraformBlueprint(std::boxed::Box<crate::model::TerraformBlueprint>),
    }
}

/// Errors encountered during actuation using Terraform
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TerraformError {
    /// Address of the resource associated with the error,
    /// e.g. `google_compute_network.vpc_network`.
    pub resource_address: std::string::String,

    /// HTTP response code returned from Google Cloud Platform APIs when Terraform
    /// fails to provision the resource. If unset or 0, no HTTP response code was
    /// returned by Terraform.
    pub http_response_code: i32,

    /// A human-readable error description.
    pub error_description: std::string::String,

    /// Output only. Original error response from underlying Google API, if
    /// available.
    pub error: std::option::Option<rpc::model::Status>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl TerraformError {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [resource_address][crate::model::TerraformError::resource_address].
    pub fn set_resource_address<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.resource_address = v.into();
        self
    }

    /// Sets the value of [http_response_code][crate::model::TerraformError::http_response_code].
    pub fn set_http_response_code<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.http_response_code = v.into();
        self
    }

    /// Sets the value of [error_description][crate::model::TerraformError::error_description].
    pub fn set_error_description<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.error_description = v.into();
        self
    }

    /// Sets the value of [error][crate::model::TerraformError::error].
    pub fn set_error<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<rpc::model::Status>,
    {
        self.error = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [error][crate::model::TerraformError::error].
    pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<rpc::model::Status>,
    {
        self.error = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for TerraformError {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.TerraformError"
    }
}

/// A set of files in a Git repository.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GitSource {
    /// Optional. Repository URL.
    /// Example: '<https://github.com/kubernetes/examples.git>'
    pub repo: std::option::Option<std::string::String>,

    /// Optional. Subdirectory inside the repository.
    /// Example: 'staging/my-package'
    pub directory: std::option::Option<std::string::String>,

    /// Optional. Git reference (e.g. branch or tag).
    pub r#ref: std::option::Option<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GitSource {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [repo][crate::model::GitSource::repo].
    pub fn set_repo<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<std::string::String>,
    {
        self.repo = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [repo][crate::model::GitSource::repo].
    pub fn set_or_clear_repo<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<std::string::String>,
    {
        self.repo = v.map(|x| x.into());
        self
    }

    /// Sets the value of [directory][crate::model::GitSource::directory].
    pub fn set_directory<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<std::string::String>,
    {
        self.directory = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [directory][crate::model::GitSource::directory].
    pub fn set_or_clear_directory<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<std::string::String>,
    {
        self.directory = v.map(|x| x.into());
        self
    }

    /// Sets the value of [r#ref][crate::model::GitSource::ref].
    pub fn set_ref<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<std::string::String>,
    {
        self.r#ref = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [r#ref][crate::model::GitSource::ref].
    pub fn set_or_clear_ref<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<std::string::String>,
    {
        self.r#ref = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for GitSource {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.GitSource"
    }
}

/// Ephemeral metadata content describing the state of a deployment operation.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeploymentOperationMetadata {
    /// The current step the deployment operation is running.
    pub step: crate::model::deployment_operation_metadata::DeploymentStep,

    /// Outputs and artifacts from applying a deployment.
    pub apply_results: std::option::Option<crate::model::ApplyResults>,

    /// Output only. Cloud Build instance UUID associated with this operation.
    pub build: std::string::String,

    /// Output only. Location of Deployment operations logs in
    /// `gs://{bucket}/{object}` format.
    pub logs: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeploymentOperationMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [step][crate::model::DeploymentOperationMetadata::step].
    pub fn set_step<
        T: std::convert::Into<crate::model::deployment_operation_metadata::DeploymentStep>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.step = v.into();
        self
    }

    /// Sets the value of [apply_results][crate::model::DeploymentOperationMetadata::apply_results].
    pub fn set_apply_results<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ApplyResults>,
    {
        self.apply_results = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [apply_results][crate::model::DeploymentOperationMetadata::apply_results].
    pub fn set_or_clear_apply_results<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ApplyResults>,
    {
        self.apply_results = v.map(|x| x.into());
        self
    }

    /// Sets the value of [build][crate::model::DeploymentOperationMetadata::build].
    pub fn set_build<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.build = v.into();
        self
    }

    /// Sets the value of [logs][crate::model::DeploymentOperationMetadata::logs].
    pub fn set_logs<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.logs = v.into();
        self
    }
}

impl wkt::message::Message for DeploymentOperationMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.DeploymentOperationMetadata"
    }
}

/// Defines additional types related to [DeploymentOperationMetadata].
pub mod deployment_operation_metadata {
    #[allow(unused_imports)]
    use super::*;

    /// The possible steps a deployment may be running.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum DeploymentStep {
        /// Unspecified deployment step
        Unspecified,
        /// Infra Manager is creating a Google Cloud Storage bucket to store
        /// artifacts and metadata about the deployment and revision
        PreparingStorageBucket,
        /// Downloading the blueprint onto the Google Cloud Storage bucket
        DownloadingBlueprint,
        /// Initializing Terraform using `terraform init`
        RunningTfInit,
        /// Running `terraform plan`
        RunningTfPlan,
        /// Actuating resources using Terraform using `terraform apply`
        RunningTfApply,
        /// Destroying resources using Terraform using `terraform destroy`
        RunningTfDestroy,
        /// Validating the uploaded TF state file when unlocking a deployment
        RunningTfValidate,
        /// Unlocking a deployment
        UnlockingDeployment,
        /// Operation was successful
        Succeeded,
        /// Operation failed
        Failed,
        /// Validating the provided repository.
        ValidatingRepository,
        /// Running quota validation
        RunningQuotaValidation,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [DeploymentStep::value] or
        /// [DeploymentStep::name].
        UnknownValue(deployment_step::UnknownValue),
    }

    #[doc(hidden)]
    pub mod deployment_step {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl DeploymentStep {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::PreparingStorageBucket => std::option::Option::Some(1),
                Self::DownloadingBlueprint => std::option::Option::Some(2),
                Self::RunningTfInit => std::option::Option::Some(3),
                Self::RunningTfPlan => std::option::Option::Some(4),
                Self::RunningTfApply => std::option::Option::Some(5),
                Self::RunningTfDestroy => std::option::Option::Some(6),
                Self::RunningTfValidate => std::option::Option::Some(7),
                Self::UnlockingDeployment => std::option::Option::Some(8),
                Self::Succeeded => std::option::Option::Some(9),
                Self::Failed => std::option::Option::Some(10),
                Self::ValidatingRepository => std::option::Option::Some(11),
                Self::RunningQuotaValidation => std::option::Option::Some(12),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("DEPLOYMENT_STEP_UNSPECIFIED"),
                Self::PreparingStorageBucket => {
                    std::option::Option::Some("PREPARING_STORAGE_BUCKET")
                }
                Self::DownloadingBlueprint => std::option::Option::Some("DOWNLOADING_BLUEPRINT"),
                Self::RunningTfInit => std::option::Option::Some("RUNNING_TF_INIT"),
                Self::RunningTfPlan => std::option::Option::Some("RUNNING_TF_PLAN"),
                Self::RunningTfApply => std::option::Option::Some("RUNNING_TF_APPLY"),
                Self::RunningTfDestroy => std::option::Option::Some("RUNNING_TF_DESTROY"),
                Self::RunningTfValidate => std::option::Option::Some("RUNNING_TF_VALIDATE"),
                Self::UnlockingDeployment => std::option::Option::Some("UNLOCKING_DEPLOYMENT"),
                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
                Self::Failed => std::option::Option::Some("FAILED"),
                Self::ValidatingRepository => std::option::Option::Some("VALIDATING_REPOSITORY"),
                Self::RunningQuotaValidation => {
                    std::option::Option::Some("RUNNING_QUOTA_VALIDATION")
                }
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for DeploymentStep {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for DeploymentStep {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for DeploymentStep {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::PreparingStorageBucket,
                2 => Self::DownloadingBlueprint,
                3 => Self::RunningTfInit,
                4 => Self::RunningTfPlan,
                5 => Self::RunningTfApply,
                6 => Self::RunningTfDestroy,
                7 => Self::RunningTfValidate,
                8 => Self::UnlockingDeployment,
                9 => Self::Succeeded,
                10 => Self::Failed,
                11 => Self::ValidatingRepository,
                12 => Self::RunningQuotaValidation,
                _ => Self::UnknownValue(deployment_step::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for DeploymentStep {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "DEPLOYMENT_STEP_UNSPECIFIED" => Self::Unspecified,
                "PREPARING_STORAGE_BUCKET" => Self::PreparingStorageBucket,
                "DOWNLOADING_BLUEPRINT" => Self::DownloadingBlueprint,
                "RUNNING_TF_INIT" => Self::RunningTfInit,
                "RUNNING_TF_PLAN" => Self::RunningTfPlan,
                "RUNNING_TF_APPLY" => Self::RunningTfApply,
                "RUNNING_TF_DESTROY" => Self::RunningTfDestroy,
                "RUNNING_TF_VALIDATE" => Self::RunningTfValidate,
                "UNLOCKING_DEPLOYMENT" => Self::UnlockingDeployment,
                "SUCCEEDED" => Self::Succeeded,
                "FAILED" => Self::Failed,
                "VALIDATING_REPOSITORY" => Self::ValidatingRepository,
                "RUNNING_QUOTA_VALIDATION" => Self::RunningQuotaValidation,
                _ => Self::UnknownValue(deployment_step::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for DeploymentStep {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::PreparingStorageBucket => serializer.serialize_i32(1),
                Self::DownloadingBlueprint => serializer.serialize_i32(2),
                Self::RunningTfInit => serializer.serialize_i32(3),
                Self::RunningTfPlan => serializer.serialize_i32(4),
                Self::RunningTfApply => serializer.serialize_i32(5),
                Self::RunningTfDestroy => serializer.serialize_i32(6),
                Self::RunningTfValidate => serializer.serialize_i32(7),
                Self::UnlockingDeployment => serializer.serialize_i32(8),
                Self::Succeeded => serializer.serialize_i32(9),
                Self::Failed => serializer.serialize_i32(10),
                Self::ValidatingRepository => serializer.serialize_i32(11),
                Self::RunningQuotaValidation => serializer.serialize_i32(12),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for DeploymentStep {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<DeploymentStep>::new(
                ".google.cloud.config.v1.DeploymentOperationMetadata.DeploymentStep",
            ))
        }
    }
}

/// Resource represents a Google Cloud Platform resource actuated by IM.
/// Resources are child resources of Revisions.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Resource {
    /// Output only. Resource name.
    /// Format:
    /// `projects/{project}/locations/{location}/deployments/{deployment}/revisions/{revision}/resources/{resource}`
    pub name: std::string::String,

    /// Output only. Terraform-specific info if this resource was created using
    /// Terraform.
    pub terraform_info: std::option::Option<crate::model::ResourceTerraformInfo>,

    /// Output only. Map of Cloud Asset Inventory (CAI) type to CAI info (e.g. CAI
    /// ID). CAI type format follows
    /// <https://cloud.google.com/asset-inventory/docs/supported-asset-types>
    pub cai_assets: std::collections::HashMap<std::string::String, crate::model::ResourceCAIInfo>,

    /// Output only. Intent of the resource.
    pub intent: crate::model::resource::Intent,

    /// Output only. Current state of the resource.
    pub state: crate::model::resource::State,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Resource {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Resource::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [terraform_info][crate::model::Resource::terraform_info].
    pub fn set_terraform_info<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ResourceTerraformInfo>,
    {
        self.terraform_info = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [terraform_info][crate::model::Resource::terraform_info].
    pub fn set_or_clear_terraform_info<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ResourceTerraformInfo>,
    {
        self.terraform_info = v.map(|x| x.into());
        self
    }

    /// Sets the value of [cai_assets][crate::model::Resource::cai_assets].
    pub fn set_cai_assets<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<crate::model::ResourceCAIInfo>,
    {
        use std::iter::Iterator;
        self.cai_assets = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [intent][crate::model::Resource::intent].
    pub fn set_intent<T: std::convert::Into<crate::model::resource::Intent>>(
        mut self,
        v: T,
    ) -> Self {
        self.intent = v.into();
        self
    }

    /// Sets the value of [state][crate::model::Resource::state].
    pub fn set_state<T: std::convert::Into<crate::model::resource::State>>(mut self, v: T) -> Self {
        self.state = v.into();
        self
    }
}

impl wkt::message::Message for Resource {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.Resource"
    }
}

/// Defines additional types related to [Resource].
pub mod resource {
    #[allow(unused_imports)]
    use super::*;

    /// Possible intent of the resource.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Intent {
        /// The default value. This value is used if the intent is omitted.
        Unspecified,
        /// Infra Manager will create this Resource.
        Create,
        /// Infra Manager will update this Resource.
        Update,
        /// Infra Manager will delete this Resource.
        Delete,
        /// Infra Manager will destroy and recreate this Resource.
        Recreate,
        /// Infra Manager will leave this Resource untouched.
        Unchanged,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [Intent::value] or
        /// [Intent::name].
        UnknownValue(intent::UnknownValue),
    }

    #[doc(hidden)]
    pub mod intent {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl Intent {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Create => std::option::Option::Some(1),
                Self::Update => std::option::Option::Some(2),
                Self::Delete => std::option::Option::Some(3),
                Self::Recreate => std::option::Option::Some(4),
                Self::Unchanged => std::option::Option::Some(5),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("INTENT_UNSPECIFIED"),
                Self::Create => std::option::Option::Some("CREATE"),
                Self::Update => std::option::Option::Some("UPDATE"),
                Self::Delete => std::option::Option::Some("DELETE"),
                Self::Recreate => std::option::Option::Some("RECREATE"),
                Self::Unchanged => std::option::Option::Some("UNCHANGED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for Intent {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for Intent {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for Intent {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Create,
                2 => Self::Update,
                3 => Self::Delete,
                4 => Self::Recreate,
                5 => Self::Unchanged,
                _ => Self::UnknownValue(intent::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for Intent {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "INTENT_UNSPECIFIED" => Self::Unspecified,
                "CREATE" => Self::Create,
                "UPDATE" => Self::Update,
                "DELETE" => Self::Delete,
                "RECREATE" => Self::Recreate,
                "UNCHANGED" => Self::Unchanged,
                _ => Self::UnknownValue(intent::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for Intent {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Create => serializer.serialize_i32(1),
                Self::Update => serializer.serialize_i32(2),
                Self::Delete => serializer.serialize_i32(3),
                Self::Recreate => serializer.serialize_i32(4),
                Self::Unchanged => serializer.serialize_i32(5),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for Intent {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Intent>::new(
                ".google.cloud.config.v1.Resource.Intent",
            ))
        }
    }

    /// Possible states of a resource.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// The default value. This value is used if the state is omitted.
        Unspecified,
        /// Resource has been planned for reconcile.
        Planned,
        /// Resource is actively reconciling into the intended state.
        InProgress,
        /// Resource has reconciled to intended state.
        Reconciled,
        /// Resource failed to reconcile.
        Failed,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Planned => std::option::Option::Some(1),
                Self::InProgress => std::option::Option::Some(2),
                Self::Reconciled => std::option::Option::Some(3),
                Self::Failed => std::option::Option::Some(4),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Planned => std::option::Option::Some("PLANNED"),
                Self::InProgress => std::option::Option::Some("IN_PROGRESS"),
                Self::Reconciled => std::option::Option::Some("RECONCILED"),
                Self::Failed => std::option::Option::Some("FAILED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Planned,
                2 => Self::InProgress,
                3 => Self::Reconciled,
                4 => Self::Failed,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "PLANNED" => Self::Planned,
                "IN_PROGRESS" => Self::InProgress,
                "RECONCILED" => Self::Reconciled,
                "FAILED" => Self::Failed,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Planned => serializer.serialize_i32(1),
                Self::InProgress => serializer.serialize_i32(2),
                Self::Reconciled => serializer.serialize_i32(3),
                Self::Failed => serializer.serialize_i32(4),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.config.v1.Resource.State",
            ))
        }
    }
}

/// Terraform info of a Resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ResourceTerraformInfo {
    /// TF resource address that uniquely identifies this resource within this
    /// deployment.
    pub address: std::string::String,

    /// TF resource type
    pub r#type: std::string::String,

    /// ID attribute of the TF resource
    pub id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ResourceTerraformInfo {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [address][crate::model::ResourceTerraformInfo::address].
    pub fn set_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.address = v.into();
        self
    }

    /// Sets the value of [r#type][crate::model::ResourceTerraformInfo::type].
    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.r#type = v.into();
        self
    }

    /// Sets the value of [id][crate::model::ResourceTerraformInfo::id].
    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.id = v.into();
        self
    }
}

impl wkt::message::Message for ResourceTerraformInfo {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.ResourceTerraformInfo"
    }
}

/// CAI info of a Resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ResourceCAIInfo {
    /// CAI resource name in the format following
    /// <https://cloud.google.com/apis/design/resource_names#full_resource_name>
    pub full_resource_name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ResourceCAIInfo {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [full_resource_name][crate::model::ResourceCAIInfo::full_resource_name].
    pub fn set_full_resource_name<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.full_resource_name = v.into();
        self
    }
}

impl wkt::message::Message for ResourceCAIInfo {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.ResourceCAIInfo"
    }
}

/// A request to get a Resource from a 'GetResource' call.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetResourceRequest {
    /// Required. The name of the Resource in the format:
    /// 'projects/{project_id}/locations/{location}/deployments/{deployment}/revisions/{revision}/resource/{resource}'.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetResourceRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetResourceRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetResourceRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.GetResourceRequest"
    }
}

/// A request to list Resources passed to a 'ListResources' call.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListResourcesRequest {
    /// Required. The parent in whose context the Resources are listed. The parent
    /// value is in the format:
    /// 'projects/{project_id}/locations/{location}/deployments/{deployment}/revisions/{revision}'.
    pub parent: std::string::String,

    /// When requesting a page of resources, 'page_size' specifies number of
    /// resources to return. If unspecified, at most 500 will be returned. The
    /// maximum value is 1000.
    pub page_size: i32,

    /// Token returned by previous call to 'ListResources' which specifies the
    /// position in the list from where to continue listing the resources.
    pub page_token: std::string::String,

    /// Lists the Resources that match the filter expression. A filter
    /// expression filters the resources listed in the response. The expression
    /// must be of the form '{field} {operator} {value}' where operators: '<', '>',
    /// '<=',
    /// '>=',
    /// '!=', '=', ':' are supported (colon ':' represents a HAS operator which is
    /// roughly synonymous with equality). {field} can refer to a proto or JSON
    /// field, or a synthetic field. Field names can be camelCase or snake_case.
    ///
    /// Examples:
    ///
    /// - Filter by name:
    ///   name =
    ///   "projects/foo/locations/us-central1/deployments/dep/revisions/bar/resources/baz
    pub filter: std::string::String,

    /// Field to use to sort the list.
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListResourcesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListResourcesRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListResourcesRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListResourcesRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListResourcesRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListResourcesRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListResourcesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.ListResourcesRequest"
    }
}

/// A response to a 'ListResources' call. Contains a list of Resources.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListResourcesResponse {
    /// List of [Resources][google.cloud.config.v1.Resource].
    ///
    /// [google.cloud.config.v1.Resource]: crate::model::Resource
    pub resources: std::vec::Vec<crate::model::Resource>,

    /// A token to request the next page of resources from the 'ListResources'
    /// method. The value of an empty string means that there are no more resources
    /// to return.
    pub next_page_token: std::string::String,

    /// Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListResourcesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [resources][crate::model::ListResourcesResponse::resources].
    pub fn set_resources<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Resource>,
    {
        use std::iter::Iterator;
        self.resources = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListResourcesResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListResourcesResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListResourcesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.ListResourcesResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListResourcesResponse {
    type PageItem = crate::model::Resource;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.resources
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Contains info about a Terraform state file
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Statefile {
    /// Output only. Cloud Storage signed URI used for downloading or uploading the
    /// state file.
    pub signed_uri: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Statefile {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [signed_uri][crate::model::Statefile::signed_uri].
    pub fn set_signed_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.signed_uri = v.into();
        self
    }
}

impl wkt::message::Message for Statefile {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.Statefile"
    }
}

/// A request to export a state file passed to a 'ExportDeploymentStatefile'
/// call.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExportDeploymentStatefileRequest {
    /// Required. The parent in whose context the statefile is listed. The parent
    /// value is in the format:
    /// 'projects/{project_id}/locations/{location}/deployments/{deployment}'.
    pub parent: std::string::String,

    /// Optional. If this flag is set to true, the exported deployment state file
    /// will be the draft state. This will enable the draft file to be validated
    /// before copying it over to the working state on unlock.
    pub draft: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ExportDeploymentStatefileRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ExportDeploymentStatefileRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [draft][crate::model::ExportDeploymentStatefileRequest::draft].
    pub fn set_draft<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.draft = v.into();
        self
    }
}

impl wkt::message::Message for ExportDeploymentStatefileRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.ExportDeploymentStatefileRequest"
    }
}

/// A request to export a state file passed to a 'ExportRevisionStatefile'
/// call.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExportRevisionStatefileRequest {
    /// Required. The parent in whose context the statefile is listed. The parent
    /// value is in the format:
    /// 'projects/{project_id}/locations/{location}/deployments/{deployment}/revisions/{revision}'.
    pub parent: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ExportRevisionStatefileRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ExportRevisionStatefileRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }
}

impl wkt::message::Message for ExportRevisionStatefileRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.ExportRevisionStatefileRequest"
    }
}

/// A request to import a state file passed to a 'ImportStatefile' call.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ImportStatefileRequest {
    /// Required. The parent in whose context the statefile is listed. The parent
    /// value is in the format:
    /// 'projects/{project_id}/locations/{location}/deployments/{deployment}'.
    pub parent: std::string::String,

    /// Required. Lock ID of the lock file to verify that the user who is importing
    /// the state file previously locked the Deployment.
    pub lock_id: i64,

    /// Optional.
    pub skip_draft: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ImportStatefileRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ImportStatefileRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [lock_id][crate::model::ImportStatefileRequest::lock_id].
    pub fn set_lock_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.lock_id = v.into();
        self
    }

    /// Sets the value of [skip_draft][crate::model::ImportStatefileRequest::skip_draft].
    pub fn set_skip_draft<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.skip_draft = v.into();
        self
    }
}

impl wkt::message::Message for ImportStatefileRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.ImportStatefileRequest"
    }
}

/// A request to delete a state file passed to a 'DeleteStatefile' call.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteStatefileRequest {
    /// Required. The name of the deployment in the format:
    /// 'projects/{project_id}/locations/{location}/deployments/{deployment}'.
    pub name: std::string::String,

    /// Required. Lock ID of the lock file to verify that the user who is deleting
    /// the state file previously locked the Deployment.
    pub lock_id: i64,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteStatefileRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteStatefileRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [lock_id][crate::model::DeleteStatefileRequest::lock_id].
    pub fn set_lock_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.lock_id = v.into();
        self
    }
}

impl wkt::message::Message for DeleteStatefileRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.DeleteStatefileRequest"
    }
}

/// A request to lock a deployment passed to a 'LockDeployment' call.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct LockDeploymentRequest {
    /// Required. The name of the deployment in the format:
    /// 'projects/{project_id}/locations/{location}/deployments/{deployment}'.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl LockDeploymentRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::LockDeploymentRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for LockDeploymentRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.LockDeploymentRequest"
    }
}

/// A request to unlock a state file passed to a 'UnlockDeployment' call.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UnlockDeploymentRequest {
    /// Required. The name of the deployment in the format:
    /// 'projects/{project_id}/locations/{location}/deployments/{deployment}'.
    pub name: std::string::String,

    /// Required. Lock ID of the lock file to be unlocked.
    pub lock_id: i64,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UnlockDeploymentRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::UnlockDeploymentRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [lock_id][crate::model::UnlockDeploymentRequest::lock_id].
    pub fn set_lock_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.lock_id = v.into();
        self
    }
}

impl wkt::message::Message for UnlockDeploymentRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.UnlockDeploymentRequest"
    }
}

/// A request to get a state file lock info passed to a 'ExportLockInfo' call.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExportLockInfoRequest {
    /// Required. The name of the deployment in the format:
    /// 'projects/{project_id}/locations/{location}/deployments/{deployment}'.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ExportLockInfoRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ExportLockInfoRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for ExportLockInfoRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.ExportLockInfoRequest"
    }
}

/// Details about the lock which locked the deployment.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct LockInfo {
    /// Unique ID for the lock to be overridden with generation ID in the backend.
    pub lock_id: i64,

    /// Terraform operation, provided by the caller.
    pub operation: std::string::String,

    /// Extra information to store with the lock, provided by the caller.
    pub info: std::string::String,

    /// user@hostname when available
    pub who: std::string::String,

    /// Terraform version
    pub version: std::string::String,

    /// Time that the lock was taken.
    pub create_time: std::option::Option<wkt::Timestamp>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl LockInfo {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [lock_id][crate::model::LockInfo::lock_id].
    pub fn set_lock_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.lock_id = v.into();
        self
    }

    /// Sets the value of [operation][crate::model::LockInfo::operation].
    pub fn set_operation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.operation = v.into();
        self
    }

    /// Sets the value of [info][crate::model::LockInfo::info].
    pub fn set_info<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.info = v.into();
        self
    }

    /// Sets the value of [who][crate::model::LockInfo::who].
    pub fn set_who<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.who = v.into();
        self
    }

    /// Sets the value of [version][crate::model::LockInfo::version].
    pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.version = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::LockInfo::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::LockInfo::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for LockInfo {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.LockInfo"
    }
}

/// A preview represents a set of actions Infra Manager would perform
/// to move the resources towards the desired state as specified in the
/// configuration.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Preview {
    /// Identifier. Resource name of the preview. Resource name can be user
    /// provided or server generated ID if unspecified. Format:
    /// `projects/{project}/locations/{location}/previews/{preview}`
    pub name: std::string::String,

    /// Output only. Time the preview was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Optional. User-defined labels for the preview.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Output only. Current state of the preview.
    pub state: crate::model::preview::State,

    /// Optional. Optional deployment reference. If specified, the preview will be
    /// performed using the provided deployment's current state and use any
    /// relevant fields from the deployment unless explicitly specified in the
    /// preview create request.
    pub deployment: std::string::String,

    /// Optional. Current mode of preview.
    pub preview_mode: crate::model::preview::PreviewMode,

    /// Required. User-specified Service Account (SA) credentials to be used when
    /// previewing resources.
    /// Format: `projects/{projectID}/serviceAccounts/{serviceAccount}`
    pub service_account: std::string::String,

    /// Optional. User-defined location of Cloud Build logs, artifacts, and
    /// in Google Cloud Storage.
    /// Format: `gs://{bucket}/{folder}`
    /// A default bucket will be bootstrapped if the field is not set or empty
    /// Default Bucket Format: `gs://<project number>-<region>-blueprint-config`
    /// Constraints:
    ///
    /// - The bucket needs to be in the same project as the deployment
    /// - The path cannot be within the path of `gcs_source`
    ///   If omitted and deployment resource ref provided has artifacts_gcs_bucket
    ///   defined, that artifact bucket is used.
    pub artifacts_gcs_bucket: std::option::Option<std::string::String>,

    /// Optional. The user-specified Worker Pool resource in which the Cloud Build
    /// job will execute. Format
    /// projects/{project}/locations/{location}/workerPools/{workerPoolId} If this
    /// field is unspecified, the default Cloud Build worker pool will be used. If
    /// omitted and deployment resource ref provided has worker_pool defined, that
    /// worker pool is used.
    pub worker_pool: std::option::Option<std::string::String>,

    /// Output only. Code describing any errors that may have occurred.
    pub error_code: crate::model::preview::ErrorCode,

    /// Output only. Additional information regarding the current state.
    pub error_status: std::option::Option<rpc::model::Status>,

    /// Output only. Cloud Build instance UUID associated with this preview.
    pub build: std::string::String,

    /// Output only. Summary of errors encountered during Terraform preview.
    /// It has a size limit of 10, i.e. only top 10 errors will be summarized here.
    pub tf_errors: std::vec::Vec<crate::model::TerraformError>,

    /// Output only. Link to tf-error.ndjson file, which contains the full list of
    /// the errors encountered during a Terraform preview.
    /// Format: `gs://{bucket}/{object}`.
    pub error_logs: std::string::String,

    /// Output only. Artifacts from preview.
    pub preview_artifacts: std::option::Option<crate::model::PreviewArtifacts>,

    /// Output only. Location of preview logs in `gs://{bucket}/{object}` format.
    pub logs: std::string::String,

    /// Output only. The current Terraform version set on the preview.
    /// It is in the format of "Major.Minor.Patch", for example, "1.3.10".
    pub tf_version: std::string::String,

    /// Optional. The user-specified Terraform version constraint.
    /// Example: "=1.3.10".
    pub tf_version_constraint: std::option::Option<std::string::String>,

    /// Optional. Arbitrary key-value metadata storage e.g. to help client tools
    /// identify preview during automation. See
    /// <https://google.aip.dev/148#annotations> for details on format and size
    /// limitations.
    pub annotations: std::collections::HashMap<std::string::String, std::string::String>,

    /// Optional. This field specifies the provider configurations.
    pub provider_config: std::option::Option<crate::model::ProviderConfig>,

    /// Blueprint to preview.
    pub blueprint: std::option::Option<crate::model::preview::Blueprint>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Preview {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Preview::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::Preview::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::Preview::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [labels][crate::model::Preview::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [state][crate::model::Preview::state].
    pub fn set_state<T: std::convert::Into<crate::model::preview::State>>(mut self, v: T) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [deployment][crate::model::Preview::deployment].
    pub fn set_deployment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.deployment = v.into();
        self
    }

    /// Sets the value of [preview_mode][crate::model::Preview::preview_mode].
    pub fn set_preview_mode<T: std::convert::Into<crate::model::preview::PreviewMode>>(
        mut self,
        v: T,
    ) -> Self {
        self.preview_mode = v.into();
        self
    }

    /// Sets the value of [service_account][crate::model::Preview::service_account].
    pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.service_account = v.into();
        self
    }

    /// Sets the value of [artifacts_gcs_bucket][crate::model::Preview::artifacts_gcs_bucket].
    pub fn set_artifacts_gcs_bucket<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<std::string::String>,
    {
        self.artifacts_gcs_bucket = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [artifacts_gcs_bucket][crate::model::Preview::artifacts_gcs_bucket].
    pub fn set_or_clear_artifacts_gcs_bucket<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<std::string::String>,
    {
        self.artifacts_gcs_bucket = v.map(|x| x.into());
        self
    }

    /// Sets the value of [worker_pool][crate::model::Preview::worker_pool].
    pub fn set_worker_pool<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<std::string::String>,
    {
        self.worker_pool = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [worker_pool][crate::model::Preview::worker_pool].
    pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<std::string::String>,
    {
        self.worker_pool = v.map(|x| x.into());
        self
    }

    /// Sets the value of [error_code][crate::model::Preview::error_code].
    pub fn set_error_code<T: std::convert::Into<crate::model::preview::ErrorCode>>(
        mut self,
        v: T,
    ) -> Self {
        self.error_code = v.into();
        self
    }

    /// Sets the value of [error_status][crate::model::Preview::error_status].
    pub fn set_error_status<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<rpc::model::Status>,
    {
        self.error_status = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [error_status][crate::model::Preview::error_status].
    pub fn set_or_clear_error_status<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<rpc::model::Status>,
    {
        self.error_status = v.map(|x| x.into());
        self
    }

    /// Sets the value of [build][crate::model::Preview::build].
    pub fn set_build<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.build = v.into();
        self
    }

    /// Sets the value of [tf_errors][crate::model::Preview::tf_errors].
    pub fn set_tf_errors<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::TerraformError>,
    {
        use std::iter::Iterator;
        self.tf_errors = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [error_logs][crate::model::Preview::error_logs].
    pub fn set_error_logs<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.error_logs = v.into();
        self
    }

    /// Sets the value of [preview_artifacts][crate::model::Preview::preview_artifacts].
    pub fn set_preview_artifacts<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::PreviewArtifacts>,
    {
        self.preview_artifacts = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [preview_artifacts][crate::model::Preview::preview_artifacts].
    pub fn set_or_clear_preview_artifacts<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::PreviewArtifacts>,
    {
        self.preview_artifacts = v.map(|x| x.into());
        self
    }

    /// Sets the value of [logs][crate::model::Preview::logs].
    pub fn set_logs<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.logs = v.into();
        self
    }

    /// Sets the value of [tf_version][crate::model::Preview::tf_version].
    pub fn set_tf_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.tf_version = v.into();
        self
    }

    /// Sets the value of [tf_version_constraint][crate::model::Preview::tf_version_constraint].
    pub fn set_tf_version_constraint<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<std::string::String>,
    {
        self.tf_version_constraint = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [tf_version_constraint][crate::model::Preview::tf_version_constraint].
    pub fn set_or_clear_tf_version_constraint<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<std::string::String>,
    {
        self.tf_version_constraint = v.map(|x| x.into());
        self
    }

    /// Sets the value of [annotations][crate::model::Preview::annotations].
    pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [provider_config][crate::model::Preview::provider_config].
    pub fn set_provider_config<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ProviderConfig>,
    {
        self.provider_config = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [provider_config][crate::model::Preview::provider_config].
    pub fn set_or_clear_provider_config<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ProviderConfig>,
    {
        self.provider_config = v.map(|x| x.into());
        self
    }

    /// Sets the value of [blueprint][crate::model::Preview::blueprint].
    ///
    /// Note that all the setters affecting `blueprint` are mutually
    /// exclusive.
    pub fn set_blueprint<
        T: std::convert::Into<std::option::Option<crate::model::preview::Blueprint>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.blueprint = v.into();
        self
    }

    /// The value of [blueprint][crate::model::Preview::blueprint]
    /// if it holds a `TerraformBlueprint`, `None` if the field is not set or
    /// holds a different branch.
    pub fn terraform_blueprint(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::TerraformBlueprint>> {
        #[allow(unreachable_patterns)]
        self.blueprint.as_ref().and_then(|v| match v {
            crate::model::preview::Blueprint::TerraformBlueprint(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [blueprint][crate::model::Preview::blueprint]
    /// to hold a `TerraformBlueprint`.
    ///
    /// Note that all the setters affecting `blueprint` are
    /// mutually exclusive.
    pub fn set_terraform_blueprint<
        T: std::convert::Into<std::boxed::Box<crate::model::TerraformBlueprint>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.blueprint = std::option::Option::Some(
            crate::model::preview::Blueprint::TerraformBlueprint(v.into()),
        );
        self
    }
}

impl wkt::message::Message for Preview {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.Preview"
    }
}

/// Defines additional types related to [Preview].
pub mod preview {
    #[allow(unused_imports)]
    use super::*;

    /// Possible states of a preview.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// The default value. This value is used if the state is unknown.
        Unspecified,
        /// The preview is being created.
        Creating,
        /// The preview has succeeded.
        Succeeded,
        /// The preview is being applied.
        Applying,
        /// The preview is stale. A preview can become stale if a revision has been
        /// applied after this preview was created.
        Stale,
        /// The preview is being deleted.
        Deleting,
        /// The preview has encountered an unexpected error.
        Failed,
        /// The preview has been deleted.
        Deleted,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Creating => std::option::Option::Some(1),
                Self::Succeeded => std::option::Option::Some(2),
                Self::Applying => std::option::Option::Some(3),
                Self::Stale => std::option::Option::Some(4),
                Self::Deleting => std::option::Option::Some(5),
                Self::Failed => std::option::Option::Some(6),
                Self::Deleted => std::option::Option::Some(7),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Creating => std::option::Option::Some("CREATING"),
                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
                Self::Applying => std::option::Option::Some("APPLYING"),
                Self::Stale => std::option::Option::Some("STALE"),
                Self::Deleting => std::option::Option::Some("DELETING"),
                Self::Failed => std::option::Option::Some("FAILED"),
                Self::Deleted => std::option::Option::Some("DELETED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Creating,
                2 => Self::Succeeded,
                3 => Self::Applying,
                4 => Self::Stale,
                5 => Self::Deleting,
                6 => Self::Failed,
                7 => Self::Deleted,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "CREATING" => Self::Creating,
                "SUCCEEDED" => Self::Succeeded,
                "APPLYING" => Self::Applying,
                "STALE" => Self::Stale,
                "DELETING" => Self::Deleting,
                "FAILED" => Self::Failed,
                "DELETED" => Self::Deleted,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Creating => serializer.serialize_i32(1),
                Self::Succeeded => serializer.serialize_i32(2),
                Self::Applying => serializer.serialize_i32(3),
                Self::Stale => serializer.serialize_i32(4),
                Self::Deleting => serializer.serialize_i32(5),
                Self::Failed => serializer.serialize_i32(6),
                Self::Deleted => serializer.serialize_i32(7),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.config.v1.Preview.State",
            ))
        }
    }

    /// Preview mode provides options for customizing preview operations.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum PreviewMode {
        /// Unspecified policy, default mode will be used.
        Unspecified,
        /// DEFAULT mode generates an execution plan for reconciling current resource
        /// state into expected resource state.
        Default,
        /// DELETE mode generates as execution plan for destroying current resources.
        Delete,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [PreviewMode::value] or
        /// [PreviewMode::name].
        UnknownValue(preview_mode::UnknownValue),
    }

    #[doc(hidden)]
    pub mod preview_mode {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl PreviewMode {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Default => std::option::Option::Some(1),
                Self::Delete => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("PREVIEW_MODE_UNSPECIFIED"),
                Self::Default => std::option::Option::Some("DEFAULT"),
                Self::Delete => std::option::Option::Some("DELETE"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for PreviewMode {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for PreviewMode {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for PreviewMode {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Default,
                2 => Self::Delete,
                _ => Self::UnknownValue(preview_mode::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for PreviewMode {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "PREVIEW_MODE_UNSPECIFIED" => Self::Unspecified,
                "DEFAULT" => Self::Default,
                "DELETE" => Self::Delete,
                _ => Self::UnknownValue(preview_mode::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for PreviewMode {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Default => serializer.serialize_i32(1),
                Self::Delete => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for PreviewMode {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<PreviewMode>::new(
                ".google.cloud.config.v1.Preview.PreviewMode",
            ))
        }
    }

    /// Possible errors that can occur with previews.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum ErrorCode {
        /// No error code was specified.
        Unspecified,
        /// Cloud Build failed due to a permissions issue.
        CloudBuildPermissionDenied,
        /// Cloud Storage bucket failed to create due to a permissions issue.
        BucketCreationPermissionDenied,
        /// Cloud Storage bucket failed for a non-permissions-related issue.
        BucketCreationFailed,
        /// Acquiring lock on provided deployment reference failed.
        DeploymentLockAcquireFailed,
        /// Preview encountered an error when trying to access Cloud Build API.
        PreviewBuildApiFailed,
        /// Preview created a build but build failed and logs were generated.
        PreviewBuildRunFailed,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [ErrorCode::value] or
        /// [ErrorCode::name].
        UnknownValue(error_code::UnknownValue),
    }

    #[doc(hidden)]
    pub mod error_code {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl ErrorCode {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::CloudBuildPermissionDenied => std::option::Option::Some(1),
                Self::BucketCreationPermissionDenied => std::option::Option::Some(2),
                Self::BucketCreationFailed => std::option::Option::Some(3),
                Self::DeploymentLockAcquireFailed => std::option::Option::Some(4),
                Self::PreviewBuildApiFailed => std::option::Option::Some(5),
                Self::PreviewBuildRunFailed => std::option::Option::Some(6),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("ERROR_CODE_UNSPECIFIED"),
                Self::CloudBuildPermissionDenied => {
                    std::option::Option::Some("CLOUD_BUILD_PERMISSION_DENIED")
                }
                Self::BucketCreationPermissionDenied => {
                    std::option::Option::Some("BUCKET_CREATION_PERMISSION_DENIED")
                }
                Self::BucketCreationFailed => std::option::Option::Some("BUCKET_CREATION_FAILED"),
                Self::DeploymentLockAcquireFailed => {
                    std::option::Option::Some("DEPLOYMENT_LOCK_ACQUIRE_FAILED")
                }
                Self::PreviewBuildApiFailed => {
                    std::option::Option::Some("PREVIEW_BUILD_API_FAILED")
                }
                Self::PreviewBuildRunFailed => {
                    std::option::Option::Some("PREVIEW_BUILD_RUN_FAILED")
                }
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for ErrorCode {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for ErrorCode {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for ErrorCode {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::CloudBuildPermissionDenied,
                2 => Self::BucketCreationPermissionDenied,
                3 => Self::BucketCreationFailed,
                4 => Self::DeploymentLockAcquireFailed,
                5 => Self::PreviewBuildApiFailed,
                6 => Self::PreviewBuildRunFailed,
                _ => Self::UnknownValue(error_code::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for ErrorCode {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "ERROR_CODE_UNSPECIFIED" => Self::Unspecified,
                "CLOUD_BUILD_PERMISSION_DENIED" => Self::CloudBuildPermissionDenied,
                "BUCKET_CREATION_PERMISSION_DENIED" => Self::BucketCreationPermissionDenied,
                "BUCKET_CREATION_FAILED" => Self::BucketCreationFailed,
                "DEPLOYMENT_LOCK_ACQUIRE_FAILED" => Self::DeploymentLockAcquireFailed,
                "PREVIEW_BUILD_API_FAILED" => Self::PreviewBuildApiFailed,
                "PREVIEW_BUILD_RUN_FAILED" => Self::PreviewBuildRunFailed,
                _ => Self::UnknownValue(error_code::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for ErrorCode {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::CloudBuildPermissionDenied => serializer.serialize_i32(1),
                Self::BucketCreationPermissionDenied => serializer.serialize_i32(2),
                Self::BucketCreationFailed => serializer.serialize_i32(3),
                Self::DeploymentLockAcquireFailed => serializer.serialize_i32(4),
                Self::PreviewBuildApiFailed => serializer.serialize_i32(5),
                Self::PreviewBuildRunFailed => serializer.serialize_i32(6),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for ErrorCode {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ErrorCode>::new(
                ".google.cloud.config.v1.Preview.ErrorCode",
            ))
        }
    }

    /// Blueprint to preview.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Blueprint {
        /// The terraform blueprint to preview.
        TerraformBlueprint(std::boxed::Box<crate::model::TerraformBlueprint>),
    }
}

/// Ephemeral metadata content describing the state of a preview operation.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PreviewOperationMetadata {
    /// The current step the preview operation is running.
    pub step: crate::model::preview_operation_metadata::PreviewStep,

    /// Artifacts from preview.
    pub preview_artifacts: std::option::Option<crate::model::PreviewArtifacts>,

    /// Output only. Location of preview logs in `gs://{bucket}/{object}` format.
    pub logs: std::string::String,

    /// Output only. Cloud Build instance UUID associated with this preview.
    pub build: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl PreviewOperationMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [step][crate::model::PreviewOperationMetadata::step].
    pub fn set_step<
        T: std::convert::Into<crate::model::preview_operation_metadata::PreviewStep>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.step = v.into();
        self
    }

    /// Sets the value of [preview_artifacts][crate::model::PreviewOperationMetadata::preview_artifacts].
    pub fn set_preview_artifacts<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::PreviewArtifacts>,
    {
        self.preview_artifacts = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [preview_artifacts][crate::model::PreviewOperationMetadata::preview_artifacts].
    pub fn set_or_clear_preview_artifacts<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::PreviewArtifacts>,
    {
        self.preview_artifacts = v.map(|x| x.into());
        self
    }

    /// Sets the value of [logs][crate::model::PreviewOperationMetadata::logs].
    pub fn set_logs<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.logs = v.into();
        self
    }

    /// Sets the value of [build][crate::model::PreviewOperationMetadata::build].
    pub fn set_build<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.build = v.into();
        self
    }
}

impl wkt::message::Message for PreviewOperationMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.PreviewOperationMetadata"
    }
}

/// Defines additional types related to [PreviewOperationMetadata].
pub mod preview_operation_metadata {
    #[allow(unused_imports)]
    use super::*;

    /// The possible steps a preview may be running.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum PreviewStep {
        /// Unspecified preview step.
        Unspecified,
        /// Infra Manager is creating a Google Cloud Storage bucket to store
        /// artifacts and metadata about the preview.
        PreparingStorageBucket,
        /// Downloading the blueprint onto the Google Cloud Storage bucket.
        DownloadingBlueprint,
        /// Initializing Terraform using `terraform init`.
        RunningTfInit,
        /// Running `terraform plan`.
        RunningTfPlan,
        /// Fetching a deployment.
        FetchingDeployment,
        /// Locking a deployment.
        LockingDeployment,
        /// Unlocking a deployment.
        UnlockingDeployment,
        /// Operation was successful.
        Succeeded,
        /// Operation failed.
        Failed,
        /// Validating the provided repository.
        ValidatingRepository,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [PreviewStep::value] or
        /// [PreviewStep::name].
        UnknownValue(preview_step::UnknownValue),
    }

    #[doc(hidden)]
    pub mod preview_step {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl PreviewStep {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::PreparingStorageBucket => std::option::Option::Some(1),
                Self::DownloadingBlueprint => std::option::Option::Some(2),
                Self::RunningTfInit => std::option::Option::Some(3),
                Self::RunningTfPlan => std::option::Option::Some(4),
                Self::FetchingDeployment => std::option::Option::Some(5),
                Self::LockingDeployment => std::option::Option::Some(6),
                Self::UnlockingDeployment => std::option::Option::Some(7),
                Self::Succeeded => std::option::Option::Some(8),
                Self::Failed => std::option::Option::Some(9),
                Self::ValidatingRepository => std::option::Option::Some(10),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("PREVIEW_STEP_UNSPECIFIED"),
                Self::PreparingStorageBucket => {
                    std::option::Option::Some("PREPARING_STORAGE_BUCKET")
                }
                Self::DownloadingBlueprint => std::option::Option::Some("DOWNLOADING_BLUEPRINT"),
                Self::RunningTfInit => std::option::Option::Some("RUNNING_TF_INIT"),
                Self::RunningTfPlan => std::option::Option::Some("RUNNING_TF_PLAN"),
                Self::FetchingDeployment => std::option::Option::Some("FETCHING_DEPLOYMENT"),
                Self::LockingDeployment => std::option::Option::Some("LOCKING_DEPLOYMENT"),
                Self::UnlockingDeployment => std::option::Option::Some("UNLOCKING_DEPLOYMENT"),
                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
                Self::Failed => std::option::Option::Some("FAILED"),
                Self::ValidatingRepository => std::option::Option::Some("VALIDATING_REPOSITORY"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for PreviewStep {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for PreviewStep {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for PreviewStep {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::PreparingStorageBucket,
                2 => Self::DownloadingBlueprint,
                3 => Self::RunningTfInit,
                4 => Self::RunningTfPlan,
                5 => Self::FetchingDeployment,
                6 => Self::LockingDeployment,
                7 => Self::UnlockingDeployment,
                8 => Self::Succeeded,
                9 => Self::Failed,
                10 => Self::ValidatingRepository,
                _ => Self::UnknownValue(preview_step::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for PreviewStep {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "PREVIEW_STEP_UNSPECIFIED" => Self::Unspecified,
                "PREPARING_STORAGE_BUCKET" => Self::PreparingStorageBucket,
                "DOWNLOADING_BLUEPRINT" => Self::DownloadingBlueprint,
                "RUNNING_TF_INIT" => Self::RunningTfInit,
                "RUNNING_TF_PLAN" => Self::RunningTfPlan,
                "FETCHING_DEPLOYMENT" => Self::FetchingDeployment,
                "LOCKING_DEPLOYMENT" => Self::LockingDeployment,
                "UNLOCKING_DEPLOYMENT" => Self::UnlockingDeployment,
                "SUCCEEDED" => Self::Succeeded,
                "FAILED" => Self::Failed,
                "VALIDATING_REPOSITORY" => Self::ValidatingRepository,
                _ => Self::UnknownValue(preview_step::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for PreviewStep {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::PreparingStorageBucket => serializer.serialize_i32(1),
                Self::DownloadingBlueprint => serializer.serialize_i32(2),
                Self::RunningTfInit => serializer.serialize_i32(3),
                Self::RunningTfPlan => serializer.serialize_i32(4),
                Self::FetchingDeployment => serializer.serialize_i32(5),
                Self::LockingDeployment => serializer.serialize_i32(6),
                Self::UnlockingDeployment => serializer.serialize_i32(7),
                Self::Succeeded => serializer.serialize_i32(8),
                Self::Failed => serializer.serialize_i32(9),
                Self::ValidatingRepository => serializer.serialize_i32(10),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for PreviewStep {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<PreviewStep>::new(
                ".google.cloud.config.v1.PreviewOperationMetadata.PreviewStep",
            ))
        }
    }
}

/// Artifacts created by preview.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PreviewArtifacts {
    /// Output only. Location of a blueprint copy and other content in Google Cloud
    /// Storage. Format: `gs://{bucket}/{object}`
    pub content: std::string::String,

    /// Output only. Location of artifacts in Google Cloud Storage.
    /// Format: `gs://{bucket}/{object}`
    pub artifacts: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl PreviewArtifacts {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [content][crate::model::PreviewArtifacts::content].
    pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.content = v.into();
        self
    }

    /// Sets the value of [artifacts][crate::model::PreviewArtifacts::artifacts].
    pub fn set_artifacts<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.artifacts = v.into();
        self
    }
}

impl wkt::message::Message for PreviewArtifacts {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.PreviewArtifacts"
    }
}

/// A request to create a preview.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreatePreviewRequest {
    /// Required. The parent in whose context the Preview is created. The parent
    /// value is in the format: 'projects/{project_id}/locations/{location}'.
    pub parent: std::string::String,

    /// Optional. The preview ID.
    pub preview_id: std::string::String,

    /// Required. [Preview][google.cloud.config.v1.Preview] resource to be created.
    ///
    /// [google.cloud.config.v1.Preview]: crate::model::Preview
    pub preview: std::option::Option<crate::model::Preview>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request ID,
    /// the server can check if original operation with the same request ID was
    /// received, and if so, will ignore the second request. This prevents clients
    /// from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreatePreviewRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreatePreviewRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [preview_id][crate::model::CreatePreviewRequest::preview_id].
    pub fn set_preview_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.preview_id = v.into();
        self
    }

    /// Sets the value of [preview][crate::model::CreatePreviewRequest::preview].
    pub fn set_preview<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Preview>,
    {
        self.preview = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [preview][crate::model::CreatePreviewRequest::preview].
    pub fn set_or_clear_preview<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Preview>,
    {
        self.preview = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::CreatePreviewRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for CreatePreviewRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.CreatePreviewRequest"
    }
}

/// A request to get details about a preview.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetPreviewRequest {
    /// Required. The name of the preview. Format:
    /// 'projects/{project_id}/locations/{location}/previews/{preview}'.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetPreviewRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetPreviewRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetPreviewRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.GetPreviewRequest"
    }
}

/// A request to list all previews for a given project and location.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListPreviewsRequest {
    /// Required. The parent in whose context the Previews are listed. The parent
    /// value is in the format: 'projects/{project_id}/locations/{location}'.
    pub parent: std::string::String,

    /// Optional. When requesting a page of resources, 'page_size' specifies number
    /// of resources to return. If unspecified, at most 500 will be returned. The
    /// maximum value is 1000.
    pub page_size: i32,

    /// Optional. Token returned by previous call to 'ListDeployments' which
    /// specifies the position in the list from where to continue listing the
    /// resources.
    pub page_token: std::string::String,

    /// Optional. Lists the Deployments that match the filter expression. A filter
    /// expression filters the resources listed in the response. The expression
    /// must be of the form '{field} {operator} {value}' where operators: '<', '>',
    /// '<=', '>=', '!=', '=', ':' are supported (colon ':' represents a HAS
    /// operator which is roughly synonymous with equality). {field} can refer to a
    /// proto or JSON field, or a synthetic field. Field names can be camelCase or
    /// snake_case.
    ///
    /// Examples:
    ///
    /// - Filter by name:
    ///   name = "projects/foo/locations/us-central1/deployments/bar
    ///
    /// - Filter by labels:
    ///
    ///   - Resources that have a key called 'foo'
    ///     labels.foo:*
    ///   - Resources that have a key called 'foo' whose value is 'bar'
    ///     labels.foo = bar
    /// - Filter by state:
    ///
    ///   - Deployments in CREATING state.
    ///     state=CREATING
    pub filter: std::string::String,

    /// Optional. Field to use to sort the list.
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListPreviewsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListPreviewsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListPreviewsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListPreviewsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListPreviewsRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListPreviewsRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListPreviewsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.ListPreviewsRequest"
    }
}

/// A response to a `ListPreviews` call. Contains a list of Previews.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListPreviewsResponse {
    /// List of [Previews][google.cloud.config.v1.Preview].
    ///
    /// [google.cloud.config.v1.Preview]: crate::model::Preview
    pub previews: std::vec::Vec<crate::model::Preview>,

    /// Token to be supplied to the next ListPreviews request via `page_token`
    /// to obtain the next set of results.
    pub next_page_token: std::string::String,

    /// Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListPreviewsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [previews][crate::model::ListPreviewsResponse::previews].
    pub fn set_previews<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Preview>,
    {
        use std::iter::Iterator;
        self.previews = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListPreviewsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListPreviewsResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListPreviewsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.ListPreviewsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListPreviewsResponse {
    type PageItem = crate::model::Preview;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.previews
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// A request to delete a preview.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeletePreviewRequest {
    /// Required. The name of the Preview in the format:
    /// 'projects/{project_id}/locations/{location}/previews/{preview}'.
    pub name: std::string::String,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes after the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request ID,
    /// the server can check if original operation with the same request ID was
    /// received, and if so, will ignore the second request. This prevents clients
    /// from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeletePreviewRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeletePreviewRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [request_id][crate::model::DeletePreviewRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for DeletePreviewRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.DeletePreviewRequest"
    }
}

/// A request to export preview results.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExportPreviewResultRequest {
    /// Required. The preview whose results should be exported. The preview value
    /// is in the format:
    /// 'projects/{project_id}/locations/{location}/previews/{preview}'.
    pub parent: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ExportPreviewResultRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ExportPreviewResultRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }
}

impl wkt::message::Message for ExportPreviewResultRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.ExportPreviewResultRequest"
    }
}

/// A response to `ExportPreviewResult` call. Contains preview results.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExportPreviewResultResponse {
    /// Output only. Signed URLs for accessing the plan files.
    pub result: std::option::Option<crate::model::PreviewResult>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ExportPreviewResultResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [result][crate::model::ExportPreviewResultResponse::result].
    pub fn set_result<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::PreviewResult>,
    {
        self.result = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [result][crate::model::ExportPreviewResultResponse::result].
    pub fn set_or_clear_result<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::PreviewResult>,
    {
        self.result = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for ExportPreviewResultResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.ExportPreviewResultResponse"
    }
}

/// Contains a signed Cloud Storage URLs.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PreviewResult {
    /// Output only. Plan binary signed URL
    pub binary_signed_uri: std::string::String,

    /// Output only. Plan JSON signed URL
    pub json_signed_uri: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl PreviewResult {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [binary_signed_uri][crate::model::PreviewResult::binary_signed_uri].
    pub fn set_binary_signed_uri<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.binary_signed_uri = v.into();
        self
    }

    /// Sets the value of [json_signed_uri][crate::model::PreviewResult::json_signed_uri].
    pub fn set_json_signed_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.json_signed_uri = v.into();
        self
    }
}

impl wkt::message::Message for PreviewResult {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.PreviewResult"
    }
}

/// The request message for the GetTerraformVersion method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetTerraformVersionRequest {
    /// Required. The name of the TerraformVersion. Format:
    /// 'projects/{project_id}/locations/{location}/terraformVersions/{terraform_version}'
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetTerraformVersionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetTerraformVersionRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetTerraformVersionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.GetTerraformVersionRequest"
    }
}

/// The request message for the ListTerraformVersions method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListTerraformVersionsRequest {
    /// Required. The parent in whose context the TerraformVersions are listed. The
    /// parent value is in the format:
    /// 'projects/{project_id}/locations/{location}'.
    pub parent: std::string::String,

    /// Optional. When requesting a page of terraform versions, 'page_size'
    /// specifies number of terraform versions to return. If unspecified, at most
    /// 500 will be returned. The maximum value is 1000.
    pub page_size: i32,

    /// Optional. Token returned by previous call to 'ListTerraformVersions' which
    /// specifies the position in the list from where to continue listing the
    /// terraform versions.
    pub page_token: std::string::String,

    /// Optional. Lists the TerraformVersions that match the filter expression. A
    /// filter expression filters the resources listed in the response. The
    /// expression must be of the form '{field} {operator} {value}' where
    /// operators: '<', '>',
    /// '<=', '>=', '!=', '=', ':' are supported (colon ':' represents a HAS
    /// operator which is roughly synonymous with equality). {field} can refer to a
    /// proto or JSON field, or a synthetic field. Field names can be camelCase or
    /// snake_case.
    pub filter: std::string::String,

    /// Optional. Field to use to sort the list.
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListTerraformVersionsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListTerraformVersionsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListTerraformVersionsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListTerraformVersionsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListTerraformVersionsRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListTerraformVersionsRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListTerraformVersionsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.ListTerraformVersionsRequest"
    }
}

/// The response message for the `ListTerraformVersions` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListTerraformVersionsResponse {
    /// List of [TerraformVersion][google.cloud.config.v1.TerraformVersion]s.
    ///
    /// [google.cloud.config.v1.TerraformVersion]: crate::model::TerraformVersion
    pub terraform_versions: std::vec::Vec<crate::model::TerraformVersion>,

    /// Token to be supplied to the next ListTerraformVersions request via
    /// `page_token` to obtain the next set of results.
    pub next_page_token: std::string::String,

    /// Unreachable resources, if any.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListTerraformVersionsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [terraform_versions][crate::model::ListTerraformVersionsResponse::terraform_versions].
    pub fn set_terraform_versions<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::TerraformVersion>,
    {
        use std::iter::Iterator;
        self.terraform_versions = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListTerraformVersionsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListTerraformVersionsResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListTerraformVersionsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.ListTerraformVersionsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListTerraformVersionsResponse {
    type PageItem = crate::model::TerraformVersion;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.terraform_versions
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// A TerraformVersion represents the support state the corresponding
/// Terraform version.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TerraformVersion {
    /// Identifier. The version name is in the format:
    /// 'projects/{project_id}/locations/{location}/terraformVersions/{terraform_version}'.
    pub name: std::string::String,

    /// Output only. The state of the version, ACTIVE, DEPRECATED or OBSOLETE.
    pub state: crate::model::terraform_version::State,

    /// Output only. When the version is supported.
    pub support_time: std::option::Option<wkt::Timestamp>,

    /// Output only. When the version is deprecated.
    pub deprecate_time: std::option::Option<wkt::Timestamp>,

    /// Output only. When the version is obsolete.
    pub obsolete_time: std::option::Option<wkt::Timestamp>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl TerraformVersion {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::TerraformVersion::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [state][crate::model::TerraformVersion::state].
    pub fn set_state<T: std::convert::Into<crate::model::terraform_version::State>>(
        mut self,
        v: T,
    ) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [support_time][crate::model::TerraformVersion::support_time].
    pub fn set_support_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.support_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [support_time][crate::model::TerraformVersion::support_time].
    pub fn set_or_clear_support_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.support_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [deprecate_time][crate::model::TerraformVersion::deprecate_time].
    pub fn set_deprecate_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.deprecate_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [deprecate_time][crate::model::TerraformVersion::deprecate_time].
    pub fn set_or_clear_deprecate_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.deprecate_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [obsolete_time][crate::model::TerraformVersion::obsolete_time].
    pub fn set_obsolete_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.obsolete_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [obsolete_time][crate::model::TerraformVersion::obsolete_time].
    pub fn set_or_clear_obsolete_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.obsolete_time = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for TerraformVersion {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.TerraformVersion"
    }
}

/// Defines additional types related to [TerraformVersion].
pub mod terraform_version {
    #[allow(unused_imports)]
    use super::*;

    /// Possible states of a TerraformVersion.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// The default value. This value is used if the state is omitted.
        Unspecified,
        /// The version is actively supported.
        Active,
        /// The version is deprecated.
        Deprecated,
        /// The version is obsolete.
        Obsolete,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Active => std::option::Option::Some(1),
                Self::Deprecated => std::option::Option::Some(2),
                Self::Obsolete => std::option::Option::Some(3),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Active => std::option::Option::Some("ACTIVE"),
                Self::Deprecated => std::option::Option::Some("DEPRECATED"),
                Self::Obsolete => std::option::Option::Some("OBSOLETE"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Active,
                2 => Self::Deprecated,
                3 => Self::Obsolete,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "ACTIVE" => Self::Active,
                "DEPRECATED" => Self::Deprecated,
                "OBSOLETE" => Self::Obsolete,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Active => serializer.serialize_i32(1),
                Self::Deprecated => serializer.serialize_i32(2),
                Self::Obsolete => serializer.serialize_i32(3),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.config.v1.TerraformVersion.State",
            ))
        }
    }
}

/// Terraform info of a ResourceChange.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ResourceChangeTerraformInfo {
    /// Output only. TF resource address that uniquely identifies the resource.
    pub address: std::string::String,

    /// Output only. TF resource type.
    pub r#type: std::string::String,

    /// Output only. TF resource name.
    pub resource_name: std::string::String,

    /// Output only. TF resource provider.
    pub provider: std::string::String,

    /// Output only. TF resource actions.
    pub actions: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ResourceChangeTerraformInfo {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [address][crate::model::ResourceChangeTerraformInfo::address].
    pub fn set_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.address = v.into();
        self
    }

    /// Sets the value of [r#type][crate::model::ResourceChangeTerraformInfo::type].
    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.r#type = v.into();
        self
    }

    /// Sets the value of [resource_name][crate::model::ResourceChangeTerraformInfo::resource_name].
    pub fn set_resource_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.resource_name = v.into();
        self
    }

    /// Sets the value of [provider][crate::model::ResourceChangeTerraformInfo::provider].
    pub fn set_provider<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.provider = v.into();
        self
    }

    /// Sets the value of [actions][crate::model::ResourceChangeTerraformInfo::actions].
    pub fn set_actions<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.actions = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ResourceChangeTerraformInfo {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.ResourceChangeTerraformInfo"
    }
}

/// A resource change represents a change to a resource in the state file.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ResourceChange {
    /// Identifier. The name of the resource change.
    /// Format:
    /// 'projects/{project_id}/locations/{location}/previews/{preview}/resourceChanges/{resource_change}'.
    pub name: std::string::String,

    /// Output only. Terraform info of the resource change.
    pub terraform_info: std::option::Option<crate::model::ResourceChangeTerraformInfo>,

    /// Output only. The intent of the resource change.
    pub intent: crate::model::resource_change::Intent,

    /// Output only. The property changes of the resource change.
    pub property_changes: std::vec::Vec<crate::model::PropertyChange>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ResourceChange {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ResourceChange::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [terraform_info][crate::model::ResourceChange::terraform_info].
    pub fn set_terraform_info<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ResourceChangeTerraformInfo>,
    {
        self.terraform_info = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [terraform_info][crate::model::ResourceChange::terraform_info].
    pub fn set_or_clear_terraform_info<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ResourceChangeTerraformInfo>,
    {
        self.terraform_info = v.map(|x| x.into());
        self
    }

    /// Sets the value of [intent][crate::model::ResourceChange::intent].
    pub fn set_intent<T: std::convert::Into<crate::model::resource_change::Intent>>(
        mut self,
        v: T,
    ) -> Self {
        self.intent = v.into();
        self
    }

    /// Sets the value of [property_changes][crate::model::ResourceChange::property_changes].
    pub fn set_property_changes<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::PropertyChange>,
    {
        use std::iter::Iterator;
        self.property_changes = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ResourceChange {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.ResourceChange"
    }
}

/// Defines additional types related to [ResourceChange].
pub mod resource_change {
    #[allow(unused_imports)]
    use super::*;

    /// Possible intent of the resource change.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Intent {
        /// The default value.
        Unspecified,
        /// The resource will be created.
        Create,
        /// The resource will be updated.
        Update,
        /// The resource will be deleted.
        Delete,
        /// The resource will be recreated.
        Recreate,
        /// The resource will be untouched.
        Unchanged,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [Intent::value] or
        /// [Intent::name].
        UnknownValue(intent::UnknownValue),
    }

    #[doc(hidden)]
    pub mod intent {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl Intent {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Create => std::option::Option::Some(1),
                Self::Update => std::option::Option::Some(2),
                Self::Delete => std::option::Option::Some(3),
                Self::Recreate => std::option::Option::Some(4),
                Self::Unchanged => std::option::Option::Some(5),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("INTENT_UNSPECIFIED"),
                Self::Create => std::option::Option::Some("CREATE"),
                Self::Update => std::option::Option::Some("UPDATE"),
                Self::Delete => std::option::Option::Some("DELETE"),
                Self::Recreate => std::option::Option::Some("RECREATE"),
                Self::Unchanged => std::option::Option::Some("UNCHANGED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for Intent {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for Intent {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for Intent {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Create,
                2 => Self::Update,
                3 => Self::Delete,
                4 => Self::Recreate,
                5 => Self::Unchanged,
                _ => Self::UnknownValue(intent::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for Intent {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "INTENT_UNSPECIFIED" => Self::Unspecified,
                "CREATE" => Self::Create,
                "UPDATE" => Self::Update,
                "DELETE" => Self::Delete,
                "RECREATE" => Self::Recreate,
                "UNCHANGED" => Self::Unchanged,
                _ => Self::UnknownValue(intent::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for Intent {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Create => serializer.serialize_i32(1),
                Self::Update => serializer.serialize_i32(2),
                Self::Delete => serializer.serialize_i32(3),
                Self::Recreate => serializer.serialize_i32(4),
                Self::Unchanged => serializer.serialize_i32(5),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for Intent {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Intent>::new(
                ".google.cloud.config.v1.ResourceChange.Intent",
            ))
        }
    }
}

/// A property change represents a change to a property in the state file.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PropertyChange {
    /// Output only. The path of the property change.
    pub path: std::string::String,

    /// Output only. The paths of sensitive fields in `before`. Paths are relative
    /// to `path`.
    pub before_sensitive_paths: std::vec::Vec<std::string::String>,

    /// Output only. Representations of the object value before the actions.
    pub before: std::option::Option<wkt::Value>,

    /// Output only. The paths of sensitive fields in `after`. Paths are relative
    /// to `path`.
    pub after_sensitive_paths: std::vec::Vec<std::string::String>,

    /// Output only. Representations of the object value after the actions.
    pub after: std::option::Option<wkt::Value>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl PropertyChange {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [path][crate::model::PropertyChange::path].
    pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.path = v.into();
        self
    }

    /// Sets the value of [before_sensitive_paths][crate::model::PropertyChange::before_sensitive_paths].
    pub fn set_before_sensitive_paths<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.before_sensitive_paths = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [before][crate::model::PropertyChange::before].
    pub fn set_before<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Value>,
    {
        self.before = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [before][crate::model::PropertyChange::before].
    pub fn set_or_clear_before<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Value>,
    {
        self.before = v.map(|x| x.into());
        self
    }

    /// Sets the value of [after_sensitive_paths][crate::model::PropertyChange::after_sensitive_paths].
    pub fn set_after_sensitive_paths<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.after_sensitive_paths = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [after][crate::model::PropertyChange::after].
    pub fn set_after<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Value>,
    {
        self.after = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [after][crate::model::PropertyChange::after].
    pub fn set_or_clear_after<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Value>,
    {
        self.after = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for PropertyChange {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.PropertyChange"
    }
}

/// The request message for the ListResourceChanges method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListResourceChangesRequest {
    /// Required. The parent in whose context the ResourceChanges are listed. The
    /// parent value is in the format:
    /// 'projects/{project_id}/locations/{location}/previews/{preview}'.
    pub parent: std::string::String,

    /// Optional. When requesting a page of resource changes, 'page_size' specifies
    /// number of resource changes to return. If unspecified, at most 500 will be
    /// returned. The maximum value is 1000.
    pub page_size: i32,

    /// Optional. Token returned by previous call to 'ListResourceChanges' which
    /// specifies the position in the list from where to continue listing the
    /// resource changes.
    pub page_token: std::string::String,

    /// Optional. Lists the resource changes that match the filter expression. A
    /// filter expression filters the resource changes listed in the response. The
    /// expression must be of the form '{field} {operator} {value}' where
    /// operators: '<', '>',
    /// '<=',
    /// '>=',
    /// '!=', '=', ':' are supported (colon ':' represents a HAS operator which is
    /// roughly synonymous with equality). {field} can refer to a proto or JSON
    /// field, or a synthetic field. Field names can be camelCase or snake_case.
    ///
    /// Examples:
    ///
    /// - Filter by name:
    ///   name =
    ///   "projects/foo/locations/us-central1/previews/dep/resourceChanges/baz
    pub filter: std::string::String,

    /// Optional. Field to use to sort the list.
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListResourceChangesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListResourceChangesRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListResourceChangesRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListResourceChangesRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListResourceChangesRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListResourceChangesRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListResourceChangesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.ListResourceChangesRequest"
    }
}

/// A response to a 'ListResourceChanges' call. Contains a list of
/// ResourceChanges.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListResourceChangesResponse {
    /// List of ResourceChanges.
    pub resource_changes: std::vec::Vec<crate::model::ResourceChange>,

    /// A token to request the next page of resources from the
    /// 'ListResourceChanges' method. The value of an empty string means that
    /// there are no more resources to return.
    pub next_page_token: std::string::String,

    /// Unreachable resources, if any.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListResourceChangesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [resource_changes][crate::model::ListResourceChangesResponse::resource_changes].
    pub fn set_resource_changes<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ResourceChange>,
    {
        use std::iter::Iterator;
        self.resource_changes = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListResourceChangesResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListResourceChangesResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListResourceChangesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.ListResourceChangesResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListResourceChangesResponse {
    type PageItem = crate::model::ResourceChange;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.resource_changes
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// The request message for the GetResourceChange method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetResourceChangeRequest {
    /// Required. The name of the resource change to retrieve.
    /// Format:
    /// 'projects/{project_id}/locations/{location}/previews/{preview}/resourceChanges/{resource_change}'.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetResourceChangeRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetResourceChangeRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetResourceChangeRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.GetResourceChangeRequest"
    }
}

/// Terraform info of a ResourceChange.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ResourceDriftTerraformInfo {
    /// Output only. The address of the drifted resource.
    pub address: std::string::String,

    /// Output only. The type of the drifted resource.
    pub r#type: std::string::String,

    /// Output only. TF resource name.
    pub resource_name: std::string::String,

    /// Output only. The provider of the drifted resource.
    pub provider: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ResourceDriftTerraformInfo {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [address][crate::model::ResourceDriftTerraformInfo::address].
    pub fn set_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.address = v.into();
        self
    }

    /// Sets the value of [r#type][crate::model::ResourceDriftTerraformInfo::type].
    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.r#type = v.into();
        self
    }

    /// Sets the value of [resource_name][crate::model::ResourceDriftTerraformInfo::resource_name].
    pub fn set_resource_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.resource_name = v.into();
        self
    }

    /// Sets the value of [provider][crate::model::ResourceDriftTerraformInfo::provider].
    pub fn set_provider<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.provider = v.into();
        self
    }
}

impl wkt::message::Message for ResourceDriftTerraformInfo {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.ResourceDriftTerraformInfo"
    }
}

/// A resource drift represents a drift to a resource in the state file.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ResourceDrift {
    /// Identifier. The name of the resource drift.
    /// Format:
    /// 'projects/{project_id}/locations/{location}/previews/{preview}/resourceDrifts/{resource_drift}'.
    pub name: std::string::String,

    /// Output only. Terraform info of the resource drift.
    pub terraform_info: std::option::Option<crate::model::ResourceDriftTerraformInfo>,

    /// Output only. The property drifts of the resource drift.
    pub property_drifts: std::vec::Vec<crate::model::PropertyDrift>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ResourceDrift {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ResourceDrift::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [terraform_info][crate::model::ResourceDrift::terraform_info].
    pub fn set_terraform_info<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ResourceDriftTerraformInfo>,
    {
        self.terraform_info = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [terraform_info][crate::model::ResourceDrift::terraform_info].
    pub fn set_or_clear_terraform_info<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ResourceDriftTerraformInfo>,
    {
        self.terraform_info = v.map(|x| x.into());
        self
    }

    /// Sets the value of [property_drifts][crate::model::ResourceDrift::property_drifts].
    pub fn set_property_drifts<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::PropertyDrift>,
    {
        use std::iter::Iterator;
        self.property_drifts = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ResourceDrift {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.ResourceDrift"
    }
}

/// A property drift represents a drift to a property in the state file.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PropertyDrift {
    /// Output only. The path of the property drift.
    pub path: std::string::String,

    /// Output only. The paths of sensitive fields in `before`. Paths are relative
    /// to `path`.
    pub before_sensitive_paths: std::vec::Vec<std::string::String>,

    /// Output only. Representations of the object value before the actions.
    pub before: std::option::Option<wkt::Value>,

    /// Output only. The paths of sensitive fields in `after`. Paths are relative
    /// to `path`.
    pub after_sensitive_paths: std::vec::Vec<std::string::String>,

    /// Output only. Representations of the object value after the actions.
    pub after: std::option::Option<wkt::Value>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl PropertyDrift {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [path][crate::model::PropertyDrift::path].
    pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.path = v.into();
        self
    }

    /// Sets the value of [before_sensitive_paths][crate::model::PropertyDrift::before_sensitive_paths].
    pub fn set_before_sensitive_paths<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.before_sensitive_paths = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [before][crate::model::PropertyDrift::before].
    pub fn set_before<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Value>,
    {
        self.before = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [before][crate::model::PropertyDrift::before].
    pub fn set_or_clear_before<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Value>,
    {
        self.before = v.map(|x| x.into());
        self
    }

    /// Sets the value of [after_sensitive_paths][crate::model::PropertyDrift::after_sensitive_paths].
    pub fn set_after_sensitive_paths<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.after_sensitive_paths = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [after][crate::model::PropertyDrift::after].
    pub fn set_after<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Value>,
    {
        self.after = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [after][crate::model::PropertyDrift::after].
    pub fn set_or_clear_after<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Value>,
    {
        self.after = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for PropertyDrift {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.PropertyDrift"
    }
}

/// The request message for the ListResourceDrifts method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListResourceDriftsRequest {
    /// Required. The parent in whose context the ResourceDrifts are listed. The
    /// parent value is in the format:
    /// 'projects/{project_id}/locations/{location}/previews/{preview}'.
    pub parent: std::string::String,

    /// Optional. When requesting a page of resource drifts, 'page_size' specifies
    /// number of resource drifts to return. If unspecified, at most 500 will be
    /// returned. The maximum value is 1000.
    pub page_size: i32,

    /// Optional. Token returned by previous call to 'ListResourceDrifts' which
    /// specifies the position in the list from where to continue listing the
    /// resource drifts.
    pub page_token: std::string::String,

    /// Optional. Lists the resource drifts that match the filter expression. A
    /// filter expression filters the resource drifts listed in the response. The
    /// expression must be of the form '{field} {operator} {value}' where
    /// operators: '<', '>',
    /// '<=',
    /// '>=',
    /// '!=', '=', ':' are supported (colon ':' represents a HAS operator which is
    /// roughly synonymous with equality). {field} can refer to a proto or JSON
    /// field, or a synthetic field. Field names can be camelCase or snake_case.
    ///
    /// Examples:
    ///
    /// - Filter by name:
    ///   name =
    ///   "projects/foo/locations/us-central1/previews/dep/resourceDrifts/baz
    pub filter: std::string::String,

    /// Optional. Field to use to sort the list.
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListResourceDriftsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListResourceDriftsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListResourceDriftsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListResourceDriftsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListResourceDriftsRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListResourceDriftsRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListResourceDriftsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.ListResourceDriftsRequest"
    }
}

/// A response to a 'ListResourceDrifts' call. Contains a list of ResourceDrifts.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListResourceDriftsResponse {
    /// List of ResourceDrifts.
    pub resource_drifts: std::vec::Vec<crate::model::ResourceDrift>,

    /// A token to request the next page of resources from the
    /// 'ListResourceDrifts' method. The value of an empty string means that
    /// there are no more resources to return.
    pub next_page_token: std::string::String,

    /// Unreachable resources, if any.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListResourceDriftsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [resource_drifts][crate::model::ListResourceDriftsResponse::resource_drifts].
    pub fn set_resource_drifts<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ResourceDrift>,
    {
        use std::iter::Iterator;
        self.resource_drifts = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListResourceDriftsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListResourceDriftsResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListResourceDriftsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.ListResourceDriftsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListResourceDriftsResponse {
    type PageItem = crate::model::ResourceDrift;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.resource_drifts
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// The request message for the GetResourceDrift method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetResourceDriftRequest {
    /// Required. The name of the resource drift to retrieve.
    /// Format:
    /// 'projects/{project_id}/locations/{location}/previews/{preview}/resourceDrifts/{resource_drift}'.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetResourceDriftRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetResourceDriftRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetResourceDriftRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.GetResourceDriftRequest"
    }
}

/// ProviderConfig contains the provider configurations.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ProviderConfig {
    /// Optional. ProviderSource specifies the source type of the provider.
    pub source_type: std::option::Option<crate::model::provider_config::ProviderSource>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ProviderConfig {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [source_type][crate::model::ProviderConfig::source_type].
    pub fn set_source_type<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::provider_config::ProviderSource>,
    {
        self.source_type = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [source_type][crate::model::ProviderConfig::source_type].
    pub fn set_or_clear_source_type<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::provider_config::ProviderSource>,
    {
        self.source_type = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for ProviderConfig {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.config.v1.ProviderConfig"
    }
}

/// Defines additional types related to [ProviderConfig].
pub mod provider_config {
    #[allow(unused_imports)]
    use super::*;

    /// ProviderSource represents the source type of the provider.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum ProviderSource {
        /// Unspecified source type, default to public sources.
        Unspecified,
        /// Service maintained provider source type.
        ServiceMaintained,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [ProviderSource::value] or
        /// [ProviderSource::name].
        UnknownValue(provider_source::UnknownValue),
    }

    #[doc(hidden)]
    pub mod provider_source {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl ProviderSource {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::ServiceMaintained => std::option::Option::Some(1),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("PROVIDER_SOURCE_UNSPECIFIED"),
                Self::ServiceMaintained => std::option::Option::Some("SERVICE_MAINTAINED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for ProviderSource {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for ProviderSource {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for ProviderSource {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::ServiceMaintained,
                _ => Self::UnknownValue(provider_source::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for ProviderSource {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "PROVIDER_SOURCE_UNSPECIFIED" => Self::Unspecified,
                "SERVICE_MAINTAINED" => Self::ServiceMaintained,
                _ => Self::UnknownValue(provider_source::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for ProviderSource {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::ServiceMaintained => serializer.serialize_i32(1),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for ProviderSource {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ProviderSource>::new(
                ".google.cloud.config.v1.ProviderConfig.ProviderSource",
            ))
        }
    }
}

/// Enum values to control quota checks for resources in terraform
/// configuration files.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum QuotaValidation {
    /// The default value.
    /// QuotaValidation on terraform configuration files will be disabled in
    /// this case.
    Unspecified,
    /// Enable computing quotas for resources in terraform configuration files to
    /// get visibility on resources with insufficient quotas.
    Enabled,
    /// Enforce quota checks so deployment fails if there isn't sufficient quotas
    /// available to deploy resources in terraform configuration files.
    Enforced,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [QuotaValidation::value] or
    /// [QuotaValidation::name].
    UnknownValue(quota_validation::UnknownValue),
}

#[doc(hidden)]
pub mod quota_validation {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl QuotaValidation {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::Enabled => std::option::Option::Some(1),
            Self::Enforced => std::option::Option::Some(2),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => std::option::Option::Some("QUOTA_VALIDATION_UNSPECIFIED"),
            Self::Enabled => std::option::Option::Some("ENABLED"),
            Self::Enforced => std::option::Option::Some("ENFORCED"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for QuotaValidation {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for QuotaValidation {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for QuotaValidation {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::Enabled,
            2 => Self::Enforced,
            _ => Self::UnknownValue(quota_validation::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for QuotaValidation {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "QUOTA_VALIDATION_UNSPECIFIED" => Self::Unspecified,
            "ENABLED" => Self::Enabled,
            "ENFORCED" => Self::Enforced,
            _ => Self::UnknownValue(quota_validation::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for QuotaValidation {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::Enabled => serializer.serialize_i32(1),
            Self::Enforced => serializer.serialize_i32(2),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for QuotaValidation {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<QuotaValidation>::new(
            ".google.cloud.config.v1.QuotaValidation",
        ))
    }
}
